Skip to content

Commit 6ef5d0d

Browse files
committed
Fix catching syntax error:
1 parent eb16b7e commit 6ef5d0d

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

6.95/plugins/Code editor/pyeditor.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -375,33 +375,23 @@ def savetext(self, fileName):
375375
os.chdir(str(self.path))
376376

377377
def runto(self):
378-
try:
379-
self.path = QtCore.QFileInfo(self.filename).path()
380-
except AttributeError:
381-
pass
378+
self.path = QtCore.QFileInfo(self.filename).path()
382379
g = globals()
383380
os.chdir(str(self.path))
384-
os.path.join(os.path.expanduser('~'), os.path.expandvars(str(self.path)))
385381
script = str(self.codebox.text())
386382
try:
387383
exec (script, g)
388384
QtGui.QCloseEvent()
389-
390-
391385
except ImportError:
392386
os.chdir(str(self.path))
393-
os.path.join(os.path.expanduser('~'), os.path.expandvars(str(self.path)))
394-
sys.path.append(str(self.path))
387+
os.path.join(os.path.expanduser('~'),
388+
os.path.expandvars(str(self.path)))
389+
sys.path.insert(0, str(self.path))
395390
exec (script, g)
396391
QtGui.QCloseEvent()
397-
398-
if TypeError (QTextStream):
399-
g = globals()
400-
os.chdir(str(self.path))
401-
os.path.join(os.path.expanduser('~'), os.path.expandvars(str(self.path)))
402-
sys.path.insert(0, str(self.path))
403-
exec int(script)
404-
QtGui.QCloseEvent()
392+
except Exception, e:
393+
print str(e)
394+
QtGui.QCloseEvent()
405395

406396

407397
def runtoprob(self):

0 commit comments

Comments
 (0)