2016-02-06 09:36:57 +00:00
|
|
|
try:
|
2018-12-31 23:25:26 +00:00
|
|
|
import idlelib.pyshell
|
2016-02-06 09:36:57 +00:00
|
|
|
except ImportError:
|
2018-12-31 23:25:26 +00:00
|
|
|
# IDLE is not installed, but maybe pyshell is on sys.path:
|
|
|
|
from . import pyshell
|
2016-02-06 09:36:57 +00:00
|
|
|
import os
|
2018-12-31 23:25:26 +00:00
|
|
|
idledir = os.path.dirname(os.path.abspath(pyshell.__file__))
|
2016-02-06 09:36:57 +00:00
|
|
|
if idledir != os.getcwd():
|
|
|
|
# We're not in the IDLE directory, help the subprocess find run.py
|
|
|
|
pypath = os.environ.get('PYTHONPATH', '')
|
|
|
|
if pypath:
|
|
|
|
os.environ['PYTHONPATH'] = pypath + ':' + idledir
|
|
|
|
else:
|
|
|
|
os.environ['PYTHONPATH'] = idledir
|
2018-12-31 23:25:26 +00:00
|
|
|
pyshell.main()
|
2016-02-06 09:36:57 +00:00
|
|
|
else:
|
2018-12-31 23:25:26 +00:00
|
|
|
idlelib.pyshell.main()
|