Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1521fda

Browse files
committed
Merged revisions 72226 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r72226 | kurt.kaiser | 2009-05-02 21:03:44 -0400 (Sat, 02 May 2009) | 3 lines idle.py modified and simplified to better support developing experimental versions of IDLE which are not installed in the standard location. ........
1 parent cef4b81 commit 1521fda

2 files changed

Lines changed: 14 additions & 22 deletions

File tree

Lib/idlelib/NEWS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ What's New in IDLE 2.7? (UNRELEASED, but merged into 3.1 releases above.)
3030

3131
*Release date: XX-XXX-2009*
3232

33+
- idle.py modified and simplified to better support developing experimental
34+
versions of IDLE which are not installed in the standard location.
35+
3336
- OutputWindow/PyShell right click menu "Go to file/line" wasn't working with
3437
file paths containing spaces. Bug 5559.
3538

Lib/idlelib/idle.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
try:
2-
import idlelib, idlelib.PyShell
3-
except ImportError:
4-
# IDLE is not installed, but maybe PyShell is on sys.path:
5-
print("*** idle.py import error! Trying alternate approach....")
6-
try:
7-
import PyShell
8-
except ImportError:
9-
raise
10-
else:
11-
import os
12-
idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
13-
if idledir != os.getcwd():
14-
# We're not in the IDLE directory, help the subprocess find run.py
15-
pypath = os.environ.get('PYTHONPATH', '')
16-
if pypath:
17-
os.environ['PYTHONPATH'] = pypath + ':' + idledir
18-
else:
19-
os.environ['PYTHONPATH'] = idledir
20-
PyShell.main()
21-
else:
22-
idlelib.PyShell.main()
1+
import os.path
2+
import sys
3+
4+
# If we are working on a development version of IDLE, we need to prepend the
5+
# parent of this idlelib dir to sys.path. Otherwise, importing idlelib gets
6+
# the version installed with the Python used to call this module:
7+
idlelib_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
8+
sys.path.insert(0, idlelib_dir)
9+
10+
import idlelib.PyShell
11+
idlelib.PyShell.main()

0 commit comments

Comments
 (0)