summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2002-12-24 06:36:19 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2002-12-24 06:36:19 (GMT)
commitf4f427681507371f70ef904a248420ef15dba2a8 (patch)
tree147b87610fef611eb57db81a4a34c49781c45ab7 /Lib/idlelib/PyShell.py
parent12bf339aea9c787f7ce655d613b8898f7511c7db (diff)
downloadcpython-f4f427681507371f70ef904a248420ef15dba2a8.zip
cpython-f4f427681507371f70ef904a248420ef15dba2a8.tar.gz
cpython-f4f427681507371f70ef904a248420ef15dba2a8.tar.bz2
M PyShell.py
M idle M idle.py M idle.pyw M setup.py Switch back to installing IDLE as a package. The IDLE GUI and the subprocess will both attempt to start up via the package mechanism, but if IDLE is not yet installed it is possible to run by calling python idle.py in the IDLE source directory, or to add the source directory to sys.path. One advantage of doing it this way is IDLE stays off sys.path. Developed in collaboration with Tony Lownds.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index e3605ac..687b539 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -319,9 +319,15 @@ class ModifiedInterpreter(InteractiveInterpreter):
# XXX what about warnoptions?
return [sys.executable, '-p', str(self.port)]
else:
- w = ['-W' + s for s in sys.warnoptions]
- return [sys.executable] + w \
- + ["-c", "__import__('run').main()", str(self.port)]
+ w = ['-W' + s for s in sys.warnoptions]
+ # Maybe IDLE is installed and is being accessed via sys.path,
+ # or maybe it's not installed and the idle.py script is being
+ # run from the IDLE source directory.
+ if __name__ == 'idlelib.PyShell':
+ command = "__import__('idlelib.run').run.main()"
+ else:
+ command = "__import__('run').main()"
+ return [sys.executable] + w + ["-c", command, str(self.port)]
def start_subprocess(self):
addr = ("localhost", self.port)