diff options
author | rahulp13 | 2020-04-09 17:34:13 +0530 |
---|---|---|
committer | rahulp13 | 2020-04-09 17:34:13 +0530 |
commit | 798f4e8221a1d62269f5a4f7d18d368baa4fab98 (patch) | |
tree | ba28df85cafdb4bf11a891724c1599bceb983e07 | |
parent | 214eab30d0ed480dbb847191499b384627abd168 (diff) | |
download | eSim-798f4e8221a1d62269f5a4f7d18d368baa4fab98.tar.gz eSim-798f4e8221a1d62269f5a4f7d18d368baa4fab98.tar.bz2 eSim-798f4e8221a1d62269f5a4f7d18d368baa4fab98.zip |
resolves issue with empty path
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.py | 28 | ||||
-rw-r--r-- | src/kicadtoNgspice/SubcircuitTab.py | 12 |
2 files changed, 22 insertions, 18 deletions
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index c4ea9a22..31ff74f7 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -90,16 +90,16 @@ class DeviceModel(QtGui.QWidget): # print("DEVICE MODEL MATCHING---", \ # child.tag, words[0]) try: - if os.path.exists(child[0].text): + if child[0].text \ + and os.path.exists(child[0].text): self.entry_var[self.count] \ .setText(child[0].text) path_name = child[0].text else: self.entry_var[self.count].setText("") - except BaseException: - print( - "Error when set text of device\ - model transistor") + except BaseException as e: + print("Error when set text of device " + + "model transistor :", str(e)) except BaseException: pass @@ -153,15 +153,16 @@ class DeviceModel(QtGui.QWidget): # print("DEVICE MODEL MATCHING---", \ # child.tag, words[0]) try: - if os.path.exists(child[0].text): + if child[0].text \ + and os.path.exists(child[0].text): path_name = child[0].text self.entry_var[self.count] \ .setText(child[0].text) else: self.entry_var[self.count].setText("") - except BaseException: - print("Error when set text of device\ - model diode") + except BaseException as e: + print("Error when set text of device " + + "model diode :", str(e)) except BaseException: pass @@ -215,15 +216,16 @@ class DeviceModel(QtGui.QWidget): # print("DEVICE MODEL MATCHING---", \ # child.tag, words[0]) try: - if os.path.exists(child[0].text): + if child[0].text \ + and os.path.exists(child[0].text): self.entry_var[self.count] \ .setText(child[0].text) path_name = child[0].text else: self.entry_var[self.count].setText("") - except BaseException: - print("Error when set text of Device\ - Model JFET ") + except BaseException as e: + print("Error when set text of Device " + + "Model JFET :", str(e)) except BaseException: pass diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index a191c639..d68cb97e 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -80,16 +80,18 @@ class SubcircuitTab(QtGui.QWidget): # print("Subcircuit MATCHING---", child.tag[0], \ # child.tag[1], eachline[0],eachline[1]) try: - if os.path.exists(child[0].text): + if child[0].text \ + and os.path.exists(child[0].text): self.entry_var[self.count] \ .setText(child[0].text) path_name = child[0].text else: self.entry_var[self.count].setText("") - except BaseException: - print("Error when set text of subcircuit") - except BaseException: - print("Error before subcircuit") + except BaseException as e: + print("Error when set text of " + + "subcircuit :", str(e)) + except BaseException as e: + print("Error before subcircuit :", str(e)) subgrid.addWidget(self.entry_var[self.count], self.row, 1) self.addbtn = QtGui.QPushButton("Add") |