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.

Author eryksun
Recipients Mark, eryksun, louielu, martin.panter, njs, terry.reedy
Date 2017-06-29.17:36:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498757819.49.0.946504379591.issue29926@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-06-29 17:36:59eryksunsetrecipients: + eryksun, terry.reedy, njs, martin.panter, Mark, louielu
2017-06-29 17:36:59eryksunsetmessageid: <1498757819.49.0.946504379591.issue29926@psf.upfronthosting.co.za>
2017-06-29 17:36:59eryksunlinkissue29926 messages
2017-06-29 17:36:59eryksuncreate