| Line | |
|---|
| 1 | try:
|
|---|
| 2 | import idlelib.PyShell
|
|---|
| 3 | except ImportError:
|
|---|
| 4 | # IDLE is not installed, but maybe PyShell is on sys.path:
|
|---|
| 5 | try:
|
|---|
| 6 | import PyShell
|
|---|
| 7 | except ImportError:
|
|---|
| 8 | raise
|
|---|
| 9 | else:
|
|---|
| 10 | import os
|
|---|
| 11 | idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
|
|---|
| 12 | if idledir != os.getcwd():
|
|---|
| 13 | # We're not in the IDLE directory, help the subprocess find run.py
|
|---|
| 14 | pypath = os.environ.get('PYTHONPATH', '')
|
|---|
| 15 | if pypath:
|
|---|
| 16 | os.environ['PYTHONPATH'] = pypath + ':' + idledir
|
|---|
| 17 | else:
|
|---|
| 18 | os.environ['PYTHONPATH'] = idledir
|
|---|
| 19 | PyShell.main()
|
|---|
| 20 | else:
|
|---|
| 21 | idlelib.PyShell.main()
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.