[issue29926] IDLE: in shell, time.sleep ignores _thread.interrupt_main()

Eryk Sun report at bugs.python.org
Thu Jun 29 13:36:59 EDT 2017


Eryk Sun added the comment:

Terry, I assume you ran IDLE via pyw.exe or pythonw.exe, which won't inherit the console of its parent. You have to use py.exe or python.exe. In this case you can also use sys.__stdout__.write('spam\n').

If you run via pythonw.exe or pyw.exe from a command prompt, you could use ctypes to attach to the console, but it would involve searching back to find the cmd.exe or powershell.exe PID to call AttachConsole(pid). More simply you can call ctypes.WinDLL('kernel32').AllocConsole() to get a new one.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29926>
_______________________________________


More information about the Python-bugs-list mailing list