[Idle-dev] CVS: idle PyShell.py,1.65,1.66 help.txt,1.8,1.9

Kurt B. Kaiser kbk@users.sourceforge.net
Thu, 15 May 2003 11:52:54 -0700


Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv29550

Modified Files:
	PyShell.py help.txt 
Log Message:
1. Add a command line switch to run without the subprocess
2. Remove the shell menu and associated bindings when running
   without the subprocess.
3. Update the IDLE Help and usage text.
4. Update display_port_binding_error to suggest using -n

M PyShell.py
M help.txt


Index: PyShell.py
===================================================================
RCS file: /cvsroot/idlefork/idle/PyShell.py,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -r1.65 -r1.66
*** PyShell.py	15 May 2003 03:40:51 -0000	1.65
--- PyShell.py	15 May 2003 18:52:50 -0000	1.66
***************
*** 333,337 ****
                  break
              except socket.error, err:
!                 print>>sys.__stderr__,"Idle socket error: " + err[1]\
                                                      + ", retrying..."
          else:
--- 333,337 ----
                  break
              except socket.error, err:
!                 print>>sys.__stderr__,"IDLE socket error: " + err[1]\
                                                      + ", retrying..."
          else:
***************
*** 651,655 ****
          ("file", "_File"),
          ("edit", "_Edit"),
-         ("shell", "_Shell"),
          ("debug", "_Debug"),
          ("options", "_Options"),
--- 651,654 ----
***************
*** 662,665 ****
--- 661,666 ----
  
      def __init__(self, flist=None):
+         if use_subprocess:
+             self.menu_specs.insert(2, ("shell", "_Shell"))
          self.interp = ModifiedInterpreter(self)
          if flist is None:
***************
*** 687,692 ****
          text.bind("<<open-python-shell>>", self.flist.open_shell)
          text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
!         text.bind("<<view-restart>>", self.view_restart_mark)
!         text.bind("<<restart-shell>>", self.restart_shell)
          #
          self.save_stdout = sys.stdout
--- 688,694 ----
          text.bind("<<open-python-shell>>", self.flist.open_shell)
          text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
!         if use_subprocess:
!             text.bind("<<view-restart>>", self.view_restart_mark)
!             text.bind("<<restart-shell>>", self.restart_shell)
          #
          self.save_stdout = sys.stdout
***************
*** 811,815 ****
  
      COPYRIGHT = \
!               'Type "copyright", "credits" or "license" for more information.'
  
      def begin(self):
--- 813,817 ----
  
      COPYRIGHT = \
!           'Type "copyright", "credits" or "license()" for more information.'
  
      def begin(self):
***************
*** 1073,1076 ****
--- 1075,1079 ----
  
    -h         print this help message and exit
+   -n         run IDLE without a subprocess (see Help/IDLE Help for details)
  
  The following options will override the IDLE 'settings' configuration:
***************
*** 1121,1124 ****
--- 1124,1128 ----
      global flist, root, use_subprocess
  
+     use_subprocess = True
      enable_shell = False
      enable_edit = False
***************
*** 1132,1136 ****
          sys.ps1 = '>>> '
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "c:deihr:st:")
      except getopt.error, msg:
          sys.stderr.write("Error: %s\n" % str(msg))
--- 1136,1140 ----
          sys.ps1 = '>>> '
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "c:deihnr:st:")
      except getopt.error, msg:
          sys.stderr.write("Error: %s\n" % str(msg))
***************
*** 1151,1154 ****
--- 1155,1160 ----
          if o == '-i':
              enable_shell = True
+         if o == '-n':
+             use_subprocess = False
          if o == '-r':
              script = a
***************
*** 1168,1174 ****
          cmd = sys.stdin.read()
          enable_shell = True
- 
-     use_subprocess = True
- 
      # process sys.argv and sys.path:
      for i in range(len(sys.path)):
--- 1174,1177 ----
***************
*** 1203,1207 ****
      root.withdraw()
      flist = PyShellFileList(root)
- 
      if enable_edit:
          if not (cmd or script):
--- 1206,1209 ----
***************
*** 1240,1256 ****
  def display_port_binding_error():
      print """\
! IDLE cannot run.
  
! IDLE needs to use a specific TCP/IP port (8833) in order to execute and
! debug programs. IDLE is unable to bind to this port, and so cannot
! start. Here are some possible causes of this problem:
  
    1. TCP/IP networking is not installed or not working on this computer
!   2. Another program is running that uses this port
    3. Personal firewall software is preventing IDLE from using this port
  
! IDLE makes and accepts connections only with this computer, and does not
! communicate over the internet in any way. Its use of port 8833 should not
! be a security risk on a single-user machine.
  """
  
--- 1242,1258 ----
  def display_port_binding_error():
      print """\
! \nIDLE cannot run.
  
! IDLE needs to use a specific TCP/IP port (8833) in order to communicate with
! its Python execution server.  IDLE is unable to bind to this port, and so
! cannot start. Here are some possible causes of this problem:
  
    1. TCP/IP networking is not installed or not working on this computer
!   2. Another program (another IDLE?) is running that uses this port
    3. Personal firewall software is preventing IDLE from using this port
  
! Run IDLE with the -n command line switch to start without a subprocess
! and refer to Help/IDLE Help "Running without a subprocess" for further
! details.
  """
  

Index: help.txt
===================================================================
RCS file: /cvsroot/idlefork/idle/help.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** help.txt	26 Jan 2003 04:17:16 -0000	1.8
--- help.txt	15 May 2003 18:52:51 -0000	1.9
***************
*** 192,193 ****
--- 192,206 ----
  	
  	Enter idle -h at the command prompt to get a usage message.
+ 
+ Running without a subprocess:
+ 
+ 	If IDLE is started with the -n command line switch it will run in a
+ 	single process and will not create the subprocess which runs the RPC
+ 	Python execution server.  This can be useful if Python cannot create
+ 	the subprocess or the RPC socket interface on your platform.  However,
+ 	in this mode user code is not isolated from IDLE itself.  Also, the
+ 	environment is not restarted when Run/Run Module (F5) is selected.  If
+ 	your code has been modified, you must reload() the affected modules and
+ 	re-import any specific items (e.g. from foo import baz) if the changes
+ 	are to take effect.  For these reasons, it is preferable to run IDLE
+ 	with the default subprocess if at all possible.