Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; 'true,': 0.05; 'false.': 0.09; 'finished.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:command': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; '"run': 0.16; '(about': 0.16; '(starting': 0.16; 'files)': 0.16; 'grep': 0.16; 'invokes': 0.16; 'invoking': 0.16; 'jumping': 0.16; 'normally.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'spawn': 0.16; 'subject:already': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'normally': 0.19; 'starts': 0.20; 'shell': 0.22; 'header :User-Agent:1': 0.23; 'error': 0.23; 'skip:i 40': 0.24; 'question': 0.24; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'raise': 0.29; 'code': 0.31; 'getting': 0.31; 'lines': 0.31; 'you?': 0.31; '"please': 0.31; 'option.': 0.31; 'sep': 0.31; 'this.': 0.32; 'run': 0.32; 'quite': 0.32; 'running': 0.33; '"the': 0.34; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'could': 0.34; 'message.': 0.35; 'problem': 0.35; 'skip:s 30': 0.35; 'one,': 0.35; 'but': 0.35; 'executing': 0.36; 'false': 0.36; 'idle': 0.36; 'shows': 0.36; 'so,': 0.37; 'window': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'called': 0.40; 'how': 0.40; 'eye': 0.61; 'new': 0.61; 'more': 0.64; 'finish': 0.65; 'here': 0.66; 'connection.': 0.74; 'future,': 0.83; 'code):': 0.84; 'received:fios.verizon.net': 0.84; 'repeat.': 0.84; '"how': 0.91; 'careful': 0.91; 'sorry.': 0.91; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: the python shell window is already executing a command Date: Wed, 17 Sep 2014 23:50:56 -0400 References: <4jrh1adtbsvnr9o20r9k3hfe4nkrkps2dk@4ax.com> <5gdk1appae03ngjlot2hg574udmnc0iqg9@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <5gdk1appae03ngjlot2hg574udmnc0iqg9@4ax.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 64 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411012292 news.xs4all.nl 2837 [2001:888:2000:d::a6]:46133 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77997 On 9/17/2014 9:34 PM, Seymore4Head wrote: > On Wed, 17 Sep 2014 18:56:47 -0400, Terry Reedy >> 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() >> >> >> 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