summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2003-05-17 03:15:48 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2003-05-17 03:15:48 (GMT)
commita80d57c41dfcfd7ae2b45b4987b28fe47ffa9dfd (patch)
tree70c7bae5672309307f713f215f94c4799077b2ca /Lib/idlelib/idle
parentab0053aa13951ad00a00c29467cc6b106725630b (diff)
downloadcpython-a80d57c41dfcfd7ae2b45b4987b28fe47ffa9dfd.zip
cpython-a80d57c41dfcfd7ae2b45b4987b28fe47ffa9dfd.tar.gz
cpython-a80d57c41dfcfd7ae2b45b4987b28fe47ffa9dfd.tar.bz2
Noam Raphael's patch.
SF Patch 686254 "Run IDLEfork from any directory without set-up" Allows IDLE to run when not installed and cwd is not the IDLE directory. I took the liberty of moving it to the startup scripts since once IDLEfork is again a part of Python it will be superfluous and I don't want it to be forgotten. But it is very useful for those using IDLEfork standalone! M CREDITS.txt M NEWS.txt M idle M idle.py M idle.pyw
Diffstat (limited to 'Lib/idlelib/idle')
-rwxr-xr-xLib/idlelib/idle14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/idlelib/idle b/Lib/idlelib/idle
index c8a8fea..449fb0e 100755
--- a/Lib/idlelib/idle
+++ b/Lib/idlelib/idle
@@ -4,7 +4,17 @@ try:
import idlelib.PyShell
except ImportError:
# IDLE is not installed, but maybe PyShell is on sys.path:
- import PyShell
- PyShell.main()
+ try:
+ import PyShell
+ except ImportError:
+ print "Can't locate PyShell.py"
+ else:
+ import os
+ idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
+ if idledir != os.getcwd():
+ # We're not in the IDLE directory, help the subprocess find run.py
+ pypath = os.environ.get('PYTHONPATH', '')
+ os.environ['PYTHONPATH'] = pypath + ':' + idledir
+ PyShell.main()
else:
idlelib.PyShell.main()