From 8e47306b993ccc9745cf8e21e1d008e6ee8e7a16 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 1 Feb 1999 23:06:17 +0000 Subject: Add current dir or paths of file args to sys.path. --- Tools/idle/PyShell.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py index 115d96f..e197ad6 100644 --- a/Tools/idle/PyShell.py +++ b/Tools/idle/PyShell.py @@ -612,6 +612,13 @@ def main(): if args: for filename in sys.argv[1:]: flist.open(filename) + aPath = os.path.abspath(os.path.dirname(filename)) + if not aPath in sys.path: + sys.path.insert(0, aPath) + else: + aPath = os.getcwd() + if not aPath in sys.path: + sys.path.insert(0, aPath) t = PyShell(flist) flist.pyshell = t t.begin() -- cgit v0.12