jpayne@69: try: jpayne@69: import idlelib.pyshell jpayne@69: except ImportError: jpayne@69: # IDLE is not installed, but maybe pyshell is on sys.path: jpayne@69: from . import pyshell jpayne@69: import os jpayne@69: idledir = os.path.dirname(os.path.abspath(pyshell.__file__)) jpayne@69: if idledir != os.getcwd(): jpayne@69: # We're not in the IDLE directory, help the subprocess find run.py jpayne@69: pypath = os.environ.get('PYTHONPATH', '') jpayne@69: if pypath: jpayne@69: os.environ['PYTHONPATH'] = pypath + ':' + idledir jpayne@69: else: jpayne@69: os.environ['PYTHONPATH'] = idledir jpayne@69: pyshell.main() jpayne@69: else: jpayne@69: idlelib.pyshell.main()