Christian Heimes added the comment:

As far as I can see print() works if sys.stdout is either None (discard
output ASAP) or a file like object. Even print(file=syst.stderr) works.

sys.stdout.write() is going to fail when sys.stdout is None but that's
not my concern. It's another well documented difference between Python
2.x and 3.x. If people still need a valid but no op stdout they can set
up their own:

class NullWriter:
    def write(self, data):
        pass

if sys.stdout is None:
    sys.stdout = NullWriter()

Done ;)

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1415>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to