From a61f4ac14d764dc4f91c5a86f170a597de4c3a73 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Mon, 1 Feb 1999 16:34:08 +0000 Subject: [PATCH] better sys.path munging when running scripts -- jvr --- Mac/Tools/IDE/PyEdit.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py index f885d049e31..8536b946ce9 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: