This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE -s and (-, -c command, or -r file) produces error message
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: kbk, ppperry, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2015-05-22 13:16 by ppperry, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg243824 - (view) Author: (ppperry) Date: 2015-05-22 13:16
When I run "python -m idlelib.idle -sc [command] from the command line, IDLE runs the startup file, but then pops up an error message saying "the Python Shell window is already executing a command;please wait until it is finished." When the error window is closed, the command executes, unless the main Python Shell has already been closed, in which case a traceback occurs:
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\lib\idlelib\idle.py", line 11, in <module>
    idlelib.PyShell.main()
  File "C:\Python27\lib\idlelib\PyShell.py", line 1602, in main
    shell.interp.execsource(cmd)
AttributeError: 'NoneType' object has no attribute 'execsource'
msg273523 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-08-24 00:40
I confirmed the bug on Win10 with 3.5 and 3.6.  "python -m idlelibl -s" prints a prompt*, runs the file and prints any output, and prints a prompt.  It then accepts user input.  When "-c command" is added, it should accept that as user input (and perhaps display it on the input line).  But I get the same error box.  When clicked away, 'command' executes and a third prompt is displayed.

*Another bug. The startup file should run first, before a prompt, just as it does in python, and just as with files run with F5. It would not hurt if [Running <path>] were printed, but not a prompt.  Prompts should mean 'ready to accept input'.  Ditto for -c command, unless IDLE is changed to display the command after the prompt as if typed in.

Warning comes from ModifiedInterpreter (MI).dispaly_executing_dialog, which is called in MI.runcommand if 'self.tkconsole.executing'.  MI.runcommand is used for internal startup code and for '-', '-c', and '-r' on the command line, but not for user '>>> ' and editor code. 

I confirmed that '-s' + '-' or '-r' give the same warning.  Hence the title change.

MI.tkconsole is the PyShell (PS) window instance.  PS.executing is set/reset in PS.beginexecuting, PS.endexecuting.  The latter should apparently be called someplace it is not now.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68453
2020-06-07 23:28:23terry.reedysetversions: + Python 3.10, - Python 3.6, Python 3.7
2017-06-30 00:03:00terry.reedysetassignee: terry.reedy
versions: + Python 3.7, - Python 2.7, Python 3.5
2016-08-24 00:40:48terry.reedysettitle: IDLE produces error message when run with both -s and -c. -> IDLE -s and (-, -c command, or -r file) produces error message
stage: test needed
messages: + msg273523
versions: + Python 3.5, Python 3.6
2015-05-22 13:41:33ppperrysettype: behavior
2015-05-22 13:16:16ppperrycreate