From a80d57c41dfcfd7ae2b45b4987b28fe47ffa9dfd Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Sat, 17 May 2003 03:15:48 +0000 Subject: 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 --- Lib/idlelib/idle.pyw | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Lib/idlelib/idle.pyw') diff --git a/Lib/idlelib/idle.pyw b/Lib/idlelib/idle.pyw index c8a8feaf6c..2a61720b40 100644 --- a/Lib/idlelib/idle.pyw +++ b/Lib/idlelib/idle.pyw @@ -1,10 +1,18 @@ -#!/usr/bin/python - 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() -- cgit v1.2.1