[issue41546] pprint() gives exception when ran from pythonw

Steve Dower report at bugs.python.org
Fri Aug 14 11:19:08 EDT 2020


Steve Dower <steve.dower at python.org> added the comment:

This is normal, if obscure, behaviour. Pythonw starts without a console, and so stdout is not connected to anything. As a result, you can't print (or pprint).

You'll need to set sys.stdout to something or provide a file if you want to print output.

If someone wants to contribute a specialised sys.stdout implementation that can raise a more helpful error message in this case, that would be helpful. But as it's a breaking change it would only go into 3.10.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41546>
_______________________________________


More information about the Python-bugs-list mailing list