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 tries to run shell window if line is completed with F5 rather than Enter
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Ramchandra Apte, asvetlov, cuulblu, ned.deily, python-dev, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2012-06-04 01:30 by cuulblu, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_error.jpg cuulblu, 2012-06-04 01:30 .jpg of error
issue14997.patch roger.serwy, 2012-06-05 17:43 review
Messages (10)
msg162246 - (view) Author: (cuulblu) Date: 2012-06-04 01:30
When using Idle any code I attempt to test I get a syntax error in the version number of the software. Please see the attached image. I have python installed on three machines and get the same error on all three. 
All three machines are Windows 7, 64 bit. Two have Intel CPU's. One is an AMD. I have tried reinstalling. Same results.
msg162256 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-06-04 11:19
Can you please run IDLE from the cmd line and send the output of it in the cmd line.
msg162277 - (view) Author: (cuulblu) Date: 2012-06-04 17:17
"Can you please run IDLE from the cmd line and send the output of it in the cmd line."

How do I do that?
msg162294 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-06-04 21:02
Try launching Python 2.7 -> Python (command line), then in the interactive interpreter enter:

    import idlelib.PyShell
    idlelib.PyShell.main()

Additional error messages may show up in the command line window.  But also try renaming or deleting the .idlerc folder in your User folder.  You may have an IDLE configuration file with an unexpected value.
msg162351 - (view) Author: (cuulblu) Date: 2012-06-05 15:18
Ned

I entered the commands you gave in the Python (command line). When Idle then opened I put test code in and am still getting the same error message. I deleted the idlerc folder. I am still getting the same error message.

To expand on the problem, I get the error message when hitting the F5 key. If I hit Enter, instead of going to a new line it runs the code, but does not produce an error message. I get the same results on all three machines mentioned in my original post. I have also installed on an older XP machine, which produces the same results. It really makes no sense to me how 4 computers can all have the same issue. (Wanders off looking for the nearest wall) I downloaded the software from this website. I have tried both 32 bit and 64 bit versions. Currently the 64 bit versions are installed on the 64 bit machines. I hope to find a solution for this soon as I am getting behind on homework.
msg162358 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-06-05 17:13
Thanks for the additional information; it's now clear what's going on.  IDLE has two kinds of windows where code can be entered.  When you launch IDLE, by default it opens with its shell window.  This window is similar to running the Python interpreter in interactive mode, i.e. you can type in lines of Python code that are immediately executed and whose results are displayed.  The other kind of window is an IDLE editor window in which you can edit a file containing Python code (either a new file or by opening an existing file).  When you are ready to run the code in the selected editor window (there may be multiple ones open), you either use the Run menu command or its accelerator shortcut, F5.  The results of running the file are also displayed in the IDLE shell window.

What seems to be happening here is that, if are you in the shell window and enter some text and press F5 rather than return/enter to complete the line, IDLE mistakenly treats the shell window as if it were an editor window and prompts you to save and then tries to run the contents of the shell window.  It shouldn't let you do that.  Thanks for bringing that error to our attention!
msg162360 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-06-05 17:43
The ScriptBinding extension is enabled for the shell. If the shell is in a modified state, then pressing F5 will bring up the save dialog (or auto-save), and then perform a syntax check. This is what cuublu experienced.

Attached is a patch against 3.3a4 to disable ScriptBinding in the shell window. The patch is identical for 2.7 branch.
msg171990 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-04 19:49
New changeset f6aaac839d83 by Andrew Svetlov in branch '3.2':
Issue #14997: disable <F5> in idle shell window.
http://hg.python.org/cpython/rev/f6aaac839d83
msg171991 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-04 19:52
New changeset 52ef53398096 by Andrew Svetlov in branch '3.3':
Merge: Issue #14997: disable <F5> in idle shell window.
http://hg.python.org/cpython/rev/52ef53398096

New changeset a40981be184d by Andrew Svetlov in branch 'default':
Merge: Issue #14997: disable <F5> in idle shell window.
http://hg.python.org/cpython/rev/a40981be184d

New changeset 06772ba3d001 by Andrew Svetlov in branch '2.7':
Issue #14997: disable <F5> in idle shell window.
http://hg.python.org/cpython/rev/06772ba3d001
msg171992 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-04 19:53
Fixed. Thanks to Roger Serwy.
History
Date User Action Args
2022-04-11 14:57:31adminsetgithub: 59202
2012-10-04 19:53:42asvetlovsetstatus: open -> closed

nosy: + asvetlov
messages: + msg171992

resolution: fixed
stage: patch review -> resolved
2012-10-04 19:52:39python-devsetmessages: + msg171991
2012-10-04 19:49:09python-devsetnosy: + python-dev
messages: + msg171990
2012-10-01 05:51:07roger.serwysetstage: needs patch -> patch review
2012-06-15 04:07:51terry.reedysetnosy: + terry.reedy
2012-06-05 17:43:32roger.serwysetfiles: + issue14997.patch

nosy: + roger.serwy
messages: + msg162360

keywords: + patch
2012-06-05 17:13:35ned.deilysetversions: + Python 3.2, Python 3.3
title: Syntax Error in Python Version Number -> IDLE tries to run shell window if line is completed with F5 rather than Enter
messages: + msg162358

type: compile error -> behavior
stage: needs patch
2012-06-05 15:18:01cuulblusetmessages: + msg162351
2012-06-04 21:02:26ned.deilysetnosy: + ned.deily
messages: + msg162294
2012-06-04 17:17:58cuulblusetmessages: + msg162277
2012-06-04 11:19:41Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg162256
2012-06-04 01:30:07cuulblucreate