mirror of
https://github.com/python/cpython.git
synced 2024-12-01 13:55:45 +08:00
ef94869f4f
IDLE. Patch by Martin Panter.
18 lines
570 B
Python
18 lines
570 B
Python
try:
|
|
import idlelib.PyShell
|
|
except ImportError:
|
|
# IDLE is not installed, but maybe PyShell is on sys.path:
|
|
from . import PyShell
|
|
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', '')
|
|
if pypath:
|
|
os.environ['PYTHONPATH'] = pypath + ':' + idledir
|
|
else:
|
|
os.environ['PYTHONPATH'] = idledir
|
|
PyShell.main()
|
|
else:
|
|
idlelib.PyShell.main()
|