17db96d56Sopenharmony_citry: 27db96d56Sopenharmony_ci import idlelib.pyshell 37db96d56Sopenharmony_ciexcept ImportError: 47db96d56Sopenharmony_ci # IDLE is not installed, but maybe pyshell is on sys.path: 57db96d56Sopenharmony_ci from . import pyshell 67db96d56Sopenharmony_ci import os 77db96d56Sopenharmony_ci idledir = os.path.dirname(os.path.abspath(pyshell.__file__)) 87db96d56Sopenharmony_ci if idledir != os.getcwd(): 97db96d56Sopenharmony_ci # We're not in the IDLE directory, help the subprocess find run.py 107db96d56Sopenharmony_ci pypath = os.environ.get('PYTHONPATH', '') 117db96d56Sopenharmony_ci if pypath: 127db96d56Sopenharmony_ci os.environ['PYTHONPATH'] = pypath + ':' + idledir 137db96d56Sopenharmony_ci else: 147db96d56Sopenharmony_ci os.environ['PYTHONPATH'] = idledir 157db96d56Sopenharmony_ci pyshell.main() 167db96d56Sopenharmony_cielse: 177db96d56Sopenharmony_ci idlelib.pyshell.main() 18