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: can't run any scripts with 2.7.x, 32 and 64-bit
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: DoctorEvil, terry.reedy
Priority: normal Keywords:

Created on 2017-12-13 22:11 by DoctorEvil, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg308260 - (view) Author: Martin (DoctorEvil) Date: 2017-12-13 22:11
When I try to run a really simple script like:
def fun(a):
    print a
    return

I get this error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1541, in __call__
    return self.func(*args)
  File "C:\Python27\lib\idlelib\MultiCall.py", line 166, in handler
    r = l[i](event)
  File "C:\Python27\lib\idlelib\ScriptBinding.py", line 149, in run_module_event

    if PyShell.use_subprocess:
AttributeError: 'module' object has no attribute 'use_subprocess'

It basically means Python is only usable by copy-pasting code into Shell, any kind of script fails with that error.
msg308453 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-12-16 05:09
Your posted code and much else runs fine for me with 2.7.14 on Win 10. Millions of lines of legal Python code run on perhaps a million machines aroung the world.  Except possibly for your particular machine, your conclusion is wrong.

From the traceback, you are running code via IDLE, most likely from the editor.  Please specify exactly what you do to get the error, starting with which 2.7.z patch release you are using.

When current Python and IDLE are correctly installed, PyShell.use_subprocess is set to True nearly first thing on startup.  If one starts IDLE with the '-n' option, use_subprocess is set to False.  The variable is never deleted.

This is the first report I know of where Python sees use_subprocess as missing.  Why?  I can think of the following possibilities of what might be wrong on your machine:
* Your python installation has a severe bug. If you need help with re-installing, try the python-list mailing list.
* Hardware bug.  See a tech.
* You are using an obsolete version of 2.7 and ran into a bug since fixed.  Upgrade to 2.7.14.
* You have MacOS and ignored https://www.python.org/download/mac/tcltk/.  Click Help and About IDLE and the box will include the tcl/tk version being run.  Follow the instruction very carefully.

None of the above are in scope for this tracker.

* You somehow triggered a severe super-obscure bug. If you convince me that there might plausibly be a bug in IDLE, and agree to help investigate, I will try to find and fix it.

For a start, run "python -m test" on a terminal or command line, where 'python' is the specific command to run 2.7 on your OS.
msg308464 - (view) Author: Martin (DoctorEvil) Date: 2017-12-16 08:43
I used Python on other machines, I know how it's supposed to work. I'm using Windows 7 and this problem happened with 2.7.14, 2.7.13 and 2.7.9. I didn't bother trying all other versions because it looked like it didn't matter what version it was. For every version, I was running scripts with PyShell file (59 KB) from idlelib.

I found another two files called "idle" in idlelib, one with and other without console. Either of those when ran starts Shell window and I can run scripts perfectly fine from there. 

I don't know what the problem is with PyShell file, but since with idle files it works as expected, I won't chase the cause of this.
History
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76496
2017-12-19 23:12:20terry.reedysetstatus: open -> closed
resolution: not a bug
stage: test needed -> resolved
2017-12-16 08:44:00DoctorEvilsetmessages: + msg308464
2017-12-16 05:11:07terry.reedysetmessages: - msg308454
2017-12-16 05:10:15terry.reedysetstatus: open

messages: + msg308454
2017-12-16 05:09:45terry.reedysetstatus: open -> (no value)

nosy: + terry.reedy
messages: + msg308453

type: behavior
stage: test needed
2017-12-13 22:11:11DoctorEvilcreate