summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle.pyw
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/idle.pyw')
-rw-r--r--Lib/idlelib/idle.pyw16
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/idlelib/idle.pyw b/Lib/idlelib/idle.pyw
index c8a8fea..2a61720 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()