From 6ecf1a6de7167bfe00cc74db6287c24f5500d328 Mon Sep 17 00:00:00 2001 From: andreika-git Date: Tue, 3 Jan 2023 21:35:36 +0200 Subject: [PATCH] Explicit error in case of duplicated designator #244 --- bin/process_BOM.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/process_BOM.py b/bin/process_BOM.py index 9dd566f..eef3aa7 100644 --- a/bin/process_BOM.py +++ b/bin/process_BOM.py @@ -47,6 +47,7 @@ if len(sys.argv) > 2: print ("Opening BOM file " + fileName + "...") rows = OrderedDict() +rowDes = OrderedDict() emptyId = 1 with open(fileName, 'rt') as f: @@ -56,6 +57,11 @@ with open(fileName, 'rt') as f: row[3] = row[3].strip() rowName = row[3] row[1] = row[1].split(", ") + for rDes in row[1]: + if rDes in rowDes: + print ("* Error! Duplicate designators found in BOM: " + rDes) + sys.exit(3) + rowDes[rDes] = 1 # all empty names should be saved separately if not rowName: rows["_" + str(emptyId)] = row