@@ -332,7 +332,7 @@ def start_subprocess(self):
332
332
self .rpcclt = rpc .RPCClient (addr )
333
333
break
334
334
except socket .error , err :
335
- print >> sys .__stderr__ ,"Idle socket error: " + err [1 ]\
335
+ print >> sys .__stderr__ ,"IDLE socket error: " + err [1 ]\
336
336
+ ", retrying..."
337
337
else :
338
338
display_port_binding_error ()
@@ -650,7 +650,6 @@ class PyShell(OutputWindow):
650
650
menu_specs = [
651
651
("file" , "_File" ),
652
652
("edit" , "_Edit" ),
653
- ("shell" , "_Shell" ),
654
653
("debug" , "_Debug" ),
655
654
("options" , "_Options" ),
656
655
("windows" , "_Windows" ),
@@ -661,6 +660,8 @@ class PyShell(OutputWindow):
661
660
from IdleHistory import History
662
661
663
662
def __init__ (self , flist = None ):
663
+ if use_subprocess :
664
+ self .menu_specs .insert (2 , ("shell" , "_Shell" ))
664
665
self .interp = ModifiedInterpreter (self )
665
666
if flist is None :
666
667
root = Tk ()
@@ -686,8 +687,9 @@ def __init__(self, flist=None):
686
687
text .bind ("<<toggle-debugger>>" , self .toggle_debugger )
687
688
text .bind ("<<open-python-shell>>" , self .flist .open_shell )
688
689
text .bind ("<<toggle-jit-stack-viewer>>" , self .toggle_jit_stack_viewer )
689
- text .bind ("<<view-restart>>" , self .view_restart_mark )
690
- text .bind ("<<restart-shell>>" , self .restart_shell )
690
+ if use_subprocess :
691
+ text .bind ("<<view-restart>>" , self .view_restart_mark )
692
+ text .bind ("<<restart-shell>>" , self .restart_shell )
691
693
#
692
694
self .save_stdout = sys .stdout
693
695
self .save_stderr = sys .stderr
@@ -810,7 +812,7 @@ def short_title(self):
810
812
return self .shell_title
811
813
812
814
COPYRIGHT = \
813
- 'Type "copyright", "credits" or "license" for more information.'
815
+ 'Type "copyright", "credits" or "license() " for more information.'
814
816
815
817
def begin (self ):
816
818
self .resetoutput ()
@@ -1072,6 +1074,7 @@ def isatty(self):
1072
1074
idle [-ds] [-t title] - [arg]*
1073
1075
1074
1076
-h print this help message and exit
1077
+ -n run IDLE without a subprocess (see Help/IDLE Help for details)
1075
1078
1076
1079
The following options will override the IDLE 'settings' configuration:
1077
1080
@@ -1120,6 +1123,7 @@ def isatty(self):
1120
1123
def main ():
1121
1124
global flist , root , use_subprocess
1122
1125
1126
+ use_subprocess = True
1123
1127
enable_shell = False
1124
1128
enable_edit = False
1125
1129
debug = False
@@ -1131,7 +1135,7 @@ def main():
1131
1135
except AttributeError :
1132
1136
sys .ps1 = '>>> '
1133
1137
try :
1134
- opts , args = getopt .getopt (sys .argv [1 :], "c:deihr :st:" )
1138
+ opts , args = getopt .getopt (sys .argv [1 :], "c:deihnr :st:" )
1135
1139
except getopt .error , msg :
1136
1140
sys .stderr .write ("Error: %s\n " % str (msg ))
1137
1141
sys .stderr .write (usage_msg )
@@ -1150,6 +1154,8 @@ def main():
1150
1154
sys .exit ()
1151
1155
if o == '-i' :
1152
1156
enable_shell = True
1157
+ if o == '-n' :
1158
+ use_subprocess = False
1153
1159
if o == '-r' :
1154
1160
script = a
1155
1161
if os .path .isfile (script ):
@@ -1167,9 +1173,6 @@ def main():
1167
1173
if args and args [0 ] == '-' :
1168
1174
cmd = sys .stdin .read ()
1169
1175
enable_shell = True
1170
-
1171
- use_subprocess = True
1172
-
1173
1176
# process sys.argv and sys.path:
1174
1177
for i in range (len (sys .path )):
1175
1178
sys .path [i ] = os .path .abspath (sys .path [i ])
@@ -1202,7 +1205,6 @@ def main():
1202
1205
fixwordbreaks (root )
1203
1206
root .withdraw ()
1204
1207
flist = PyShellFileList (root )
1205
-
1206
1208
if enable_edit :
1207
1209
if not (cmd or script ):
1208
1210
for filename in args :
@@ -1239,19 +1241,19 @@ def main():
1239
1241
1240
1242
def display_port_binding_error ():
1241
1243
print """\
1242
- IDLE cannot run.
1244
+ \n IDLE cannot run.
1243
1245
1244
- IDLE needs to use a specific TCP/IP port (8833) in order to execute and
1245
- debug programs. IDLE is unable to bind to this port, and so cannot
1246
- start. Here are some possible causes of this problem:
1246
+ IDLE needs to use a specific TCP/IP port (8833) in order to communicate with
1247
+ its Python execution server. IDLE is unable to bind to this port, and so
1248
+ cannot start. Here are some possible causes of this problem:
1247
1249
1248
1250
1. TCP/IP networking is not installed or not working on this computer
1249
- 2. Another program is running that uses this port
1251
+ 2. Another program (another IDLE?) is running that uses this port
1250
1252
3. Personal firewall software is preventing IDLE from using this port
1251
1253
1252
- IDLE makes and accepts connections only with this computer, and does not
1253
- communicate over the internet in any way. Its use of port 8833 should not
1254
- be a security risk on a single-user machine .
1254
+ Run IDLE with the -n command line switch to start without a subprocess
1255
+ and refer to Help/IDLE Help "Running without a subprocess" for further
1256
+ details .
1255
1257
"""
1256
1258
1257
1259
if __name__ == "__main__" :
0 commit comments