import sys, codecs, io
codecsout = codecs.getwriter('utf8')(sys.stdout)
ioout = io.open(sys.stdout.fileno(), mode='w', encoding='utf8')
print >> sys.stdout, 1
print >> codecsout, 2
print >> ioout, 3
Fails with:
1
2
Traceback (most recent call last):
File "print.py", line 7, in <module>
print >> ioout, 3
TypeError: must be unicode, not str
It fails with print(3, file=ioout)
from the __future__
as well.
Does print
not know how to talk to the io
module?