idle.pyw 563 B

1234567891011121314151617
  1. try:
  2. import idlelib.PyShell
  3. except ImportError:
  4. # IDLE is not installed, but maybe PyShell is on sys.path:
  5. import PyShell
  6. import os
  7. idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
  8. 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
  15. PyShell.main()
  16. else:
  17. idlelib.PyShell.main()