Skip to content

Commit c81cdf1

Browse files
committed
fix path when you havent opened a file
1 parent a89eeda commit c81cdf1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/Code editor/pyeditor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def runto(self):
356356
except ImportError:
357357
os.chdir(str(self.path))
358358
os.path.join(os.path.expanduser('~'), os.path.expandvars(str(self.path)))
359-
sys.path.insert(0, str(self.path))
359+
sys.path.append(str(self.path))
360360
exec (script, g)
361361
QtGui.QCloseEvent()
362362

@@ -369,6 +369,10 @@ def runto(self):
369369
QtGui.QCloseEvent()
370370

371371
def runtoprob(self):
372+
try:
373+
self.path = QtCore.QFileInfo(self.filename).path()
374+
except AttributeError:
375+
pass
372376
self.path = QtCore.QFileInfo(self.filename).path()
373377
g = globals()
374378
os.chdir(str(self.path))

0 commit comments

Comments
 (0)