blob: e73c049b70cc5aac3687d363f3089f9c0047c4ce [file] [log] [blame]
Kurt B. Kaiserf4f42762002-12-24 06:36:19 +00001try:
Terry Jan Reedy6fa5bdc2016-05-28 13:22:31 -04002 import idlelib.pyshell
Kurt B. Kaiser7cca3d82002-12-31 23:18:00 +00003except ImportError:
Terry Jan Reedy6fa5bdc2016-05-28 13:22:31 -04004 # IDLE is not installed, but maybe pyshell is on sys.path:
5 from . import pyshell
Serhiy Storchakaef948692015-05-20 16:15:02 +03006 import os
Terry Jan Reedy6fa5bdc2016-05-28 13:22:31 -04007 idledir = os.path.dirname(os.path.abspath(pyshell.__file__))
Serhiy Storchakaef948692015-05-20 16:15:02 +03008 if idledir != os.getcwd():
9 # We're not in the IDLE directory, help the subprocess find run.py
10 pypath = os.environ.get('PYTHONPATH', '')
11 if pypath:
12 os.environ['PYTHONPATH'] = pypath + ':' + idledir
13 else:
14 os.environ['PYTHONPATH'] = idledir
Terry Jan Reedy6fa5bdc2016-05-28 13:22:31 -040015 pyshell.main()
Kurt B. Kaisere23ca3c2003-01-02 17:09:34 +000016else:
Terry Jan Reedy6fa5bdc2016-05-28 13:22:31 -040017 idlelib.pyshell.main()