Commit a61f4ac1 authored by Just van Rossum's avatar Just van Rossum

better sys.path munging when running scripts -- jvr

parent 98be47e7
......@@ -501,12 +501,7 @@ class Editor(W.Window):
dir = os.path.dirname(self.path)
savedir = os.getcwd()
os.chdir(dir)
try:
cwdindex = sys.path.index(os.curdir)
except ValueError:
cwdindex = None
else:
sys.path[cwdindex] = dir
sys.path.insert(0, dir)
else:
cwdindex = None
try:
......@@ -515,8 +510,7 @@ class Editor(W.Window):
finally:
if self.path:
os.chdir(savedir)
if cwdindex is not None:
sys.path[cwdindex] = os.curdir
del sys.path[0]
def getenvironment(self):
if self.path:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment