summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-12-21 21:39:11 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-12-21 21:39:11 (GMT)
commitff002b93057d1ba8662caed8f9bcbb643fe66c8a (patch)
tree638474620c0810db9c958992f7f055774ef7155c /Lib/idlelib
parentdd70e1be91dcf4d20150f11cc0262c9e623b1fae (diff)
downloadcpython-ff002b93057d1ba8662caed8f9bcbb643fe66c8a.zip
cpython-ff002b93057d1ba8662caed8f9bcbb643fe66c8a.tar.gz
cpython-ff002b93057d1ba8662caed8f9bcbb643fe66c8a.tar.bz2
When IDLE is installed and run from a startup script, the script's
directory becomes sys.path[0]. What is wanted is the directory from which IDLE was called. Insert the current working directory in the path if it isn't there already.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/PyShell.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 2abde13..ad57ebe 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -29,6 +29,7 @@ import idlever
import rpc
import RemoteDebugger
+# Preserve 2.2 compatibility for Mac OS X:
import boolcheck
IDENTCHARS = string.ascii_letters + string.digits + "_"
@@ -1169,6 +1170,10 @@ def main():
dir = os.path.abspath(dir)
if not dir in sys.path:
sys.path.insert(0, dir)
+ else:
+ dir = os.getcwd()
+ if not dir in sys.path:
+ sys.path.insert(0, dir)
# check the IDLE settings configuration (but command line overrides)
edit_start = idleConf.GetOption('main', 'General',
'editor-on-startup', type='bool')