]> granicus.if.org Git - python/commitdiff
Add current dir or paths of file args to sys.path.
authorGuido van Rossum <guido@python.org>
Mon, 1 Feb 1999 23:06:17 +0000 (23:06 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 1 Feb 1999 23:06:17 +0000 (23:06 +0000)
Tools/idle/PyShell.py

index 115d96f8f991fd8722a830625f3e4a49f96671f3..e197ad623745439b84dde49923bf46a7040a7faa 100644 (file)
@@ -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()