summaryrefslogtreecommitdiffstats
path: root/Mac/Tools/IDE
diff options
context:
space:
mode:
authorJust van Rossum <just@lettererror.com>1999-02-01 16:34:08 (GMT)
committerJust van Rossum <just@lettererror.com>1999-02-01 16:34:08 (GMT)
commita61f4ac14d764dc4f91c5a86f170a597de4c3a73 (patch)
tree936a0529c38d9b455f9f53f14c492251128fb01b /Mac/Tools/IDE
parent98be47e7373e5266ded7f6db993fe4dc84b79772 (diff)
downloadcpython-a61f4ac14d764dc4f91c5a86f170a597de4c3a73.zip
cpython-a61f4ac14d764dc4f91c5a86f170a597de4c3a73.tar.gz
cpython-a61f4ac14d764dc4f91c5a86f170a597de4c3a73.tar.bz2
better sys.path munging when running scripts -- jvr
Diffstat (limited to 'Mac/Tools/IDE')
-rw-r--r--Mac/Tools/IDE/PyEdit.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py
index f885d04..8536b94 100644
--- a/Mac/Tools/IDE/PyEdit.py
+++ b/Mac/Tools/IDE/PyEdit.py
@@ -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: