diff Lib/idlelib/PyShell.py @ 26774:89dd74f7ae32 legacy-trunk

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.
author Kurt B. Kaiser <kbk@shore.net>
date Tue, 24 Dec 2002 06:36:19 +0000
parents 240fdbef8c60
children 143922a40fac
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py	Tue Dec 24 05:41:27 2002 +0000
+++ b/Lib/idlelib/PyShell.py	Tue Dec 24 06:36:19 2002 +0000
@@ -319,9 +319,15 @@
             # 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)