Kurt B. Kaiser | f4f4276 | 2002-12-24 06:36:19 +0000 | [diff] [blame] | 1 | try: |
| 2 | import idlelib.PyShell |
Kurt B. Kaiser | 7cca3d8 | 2002-12-31 23:18:00 +0000 | [diff] [blame] | 3 | except ImportError: |
Kurt B. Kaiser | f4f4276 | 2002-12-24 06:36:19 +0000 | [diff] [blame] | 4 | # IDLE is not installed, but maybe PyShell is on sys.path: |
Kurt B. Kaiser | a80d57c | 2003-05-17 03:15:48 +0000 | [diff] [blame] | 5 | try: |
| 6 | import PyShell |
| 7 | except ImportError: |
Kurt B. Kaiser | c626658 | 2003-05-19 02:07:44 +0000 | [diff] [blame] | 8 | raise |
Kurt B. Kaiser | a80d57c | 2003-05-17 03:15:48 +0000 | [diff] [blame] | 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', '') |
Kurt B. Kaiser | 36364be | 2003-05-24 21:01:39 +0000 | [diff] [blame] | 15 | if pypath: |
| 16 | os.environ['PYTHONPATH'] = pypath + ':' + idledir |
| 17 | else: |
| 18 | os.environ['PYTHONPATH'] = idledir |
Kurt B. Kaiser | a80d57c | 2003-05-17 03:15:48 +0000 | [diff] [blame] | 19 | PyShell.main() |
Kurt B. Kaiser | e23ca3c | 2003-01-02 17:09:34 +0000 | [diff] [blame] | 20 | else: |
| 21 | idlelib.PyShell.main() |