Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77997

Re: the python shell window is already executing a command

From Terry Reedy <tjreedy@udel.edu>
Subject Re: the python shell window is already executing a command
Date 2014-09-17 23:50 -0400
References <4jrh1adtbsvnr9o20r9k3hfe4nkrkps2dk@4ax.com> <mailman.14068.1410940978.18130.python-list@python.org> <lsaj1a5pm5k301k9ipn6fcsra5c776bs1q@4ax.com> <mailman.14090.1410994642.18130.python-list@python.org> <5gdk1appae03ngjlot2hg574udmnc0iqg9@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.14096.1411012292.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 9/17/2014 9:34 PM, Seymore4Head wrote:
> On Wed, 17 Sep 2014 18:56:47 -0400, Terry Reedy <tjreedy@udel.edu>

>> A little digging with Idle's grep (Find in Files) shows that the message
>> is produced by this code in idlelib/PyShell.py, about 825.
>>
>>      def display_executing_dialog(self):
>>          tkMessageBox.showerror(
>>              "Already executing",
>>              "The Python Shell window is already executing a command; "
>>              "please wait until it is finished.",
>>              master=self.tkconsole.text)
>>
>> This function is only called here (about line 735)
>>      def runcommand(self, code):
>>          "Run the code without invoking the debugger"
>>          # The code better not raise an exception!
>>          if self.tkconsole.executing:
>>              self.display_executing_dialog()
>>          <else run idle code in user process output view user>
>>
>> How is this run?  Run-Module F5 invokes
>> ScriptBinding.run_module_event(116) and thence _run_module_event (129).
>> This methods includes this.
>>          if PyShell.use_subprocess:
>>              interp.restart_subprocess(with_cwd=False)
>>
>> restart_subprocess includes these lines (starting at 470):
>>          # Kill subprocess, spawn a new one, accept connection.
>>          self.rpcclt.close()
>>          self.terminate_subprocess()
>>          console = self.tkconsole
>>          ...
>>          console.executing = False  # == self.tkconsole
>>          ...
>>          self.transfer_path(with_cwd=with_cwd)
>>
>> transfer_path calls runcommand but only after tkconsole.executing has
>> been set to False.  But this only happens if PyShell.use_subprocess is
>> True, which it normally is, but not if one starts Idle with the -n option.
>>
>> After conditionally calling interp.restart_subprocess, _run_module_event
>> directly calls interp.runcommand, which can fail when running with -n.
>> Are you?  This is the only way I know to get the error message.  Is so,
>> the second way to not get the error message is to not use -n and run
>> normally.
>
> Sorry.  I don't speak python yet.  Quite a few of the above terms are
> new to me.
>
> It may be that was trying to run the program again before the current
> one was finished.  In the past I was getting the error when I was
> (almost) sure the program had finished.  I will be more careful in the
> future, but I will also keep an eye out for the problem to repeat.
> I just tried to run the above program again and gave it more time to
> finish and I did not get the error, so it could well be I was jumping
> the gun.

My question was "How do you start Idle?"
(I can make a difference.)

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

the python shell window is already executing a command Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-16 22:17 -0400
  Re: the python shell window is already executing a command Terry Reedy <tjreedy@udel.edu> - 2014-09-17 04:02 -0400
    Re: the python shell window is already executing a command Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-17 11:55 -0400
      Re: the python shell window is already executing a command Terry Reedy <tjreedy@udel.edu> - 2014-09-17 18:56 -0400
        Re: the python shell window is already executing a command Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-17 21:34 -0400
          Re: the python shell window is already executing a command Terry Reedy <tjreedy@udel.edu> - 2014-09-17 23:50 -0400
            Re: the python shell window is already executing a command Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-18 11:24 -0400
              Re: the python shell window is already executing a command Terry Reedy <tjreedy@udel.edu> - 2014-09-18 15:05 -0400
                Re: the python shell window is already executing a command Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-18 15:58 -0400
              Re: the python shell window is already executing a command Chris Angelico <rosuav@gmail.com> - 2014-09-19 12:51 +1000
              Re: the python shell window is already executing a command Terry Reedy <tjreedy@udel.edu> - 2014-09-19 15:43 -0400
              Re: the python shell window is already executing a command Chris Angelico <rosuav@gmail.com> - 2014-09-20 05:47 +1000
  Re: the python shell window is already executing a command Tony the Tiger <tony@tiger.invalid> - 2014-09-18 16:50 +0000

csiph-web