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): ...@@ -501,12 +501,7 @@ class Editor(W.Window):
dir = os.path.dirname(self.path) dir = os.path.dirname(self.path)
savedir = os.getcwd() savedir = os.getcwd()
os.chdir(dir) os.chdir(dir)
try: sys.path.insert(0, dir)
cwdindex = sys.path.index(os.curdir)
except ValueError:
cwdindex = None
else:
sys.path[cwdindex] = dir
else: else:
cwdindex = None cwdindex = None
try: try:
...@@ -515,8 +510,7 @@ class Editor(W.Window): ...@@ -515,8 +510,7 @@ class Editor(W.Window):
finally: finally:
if self.path: if self.path:
os.chdir(savedir) os.chdir(savedir)
if cwdindex is not None: del sys.path[0]
sys.path[cwdindex] = os.curdir
def getenvironment(self): def getenvironment(self):
if self.path: 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