printing bytes to stdout in Py3

Peter Billam peter at www.pjb.com.au
Tue Feb 17 00:04:23 EST 2009


Greetings. (Newbie warning as usual) In Python3, sys.stdout is a
io.TextIOWrapper object; but I want to output bytes
  (e.g. muscript -midi t > t.mid )
and they're coming out stringified :-(  How can I either change the
encoding on sys.stdout, or close sys.stdout and reopen it in 'b'
mode, or dup(fd) it first, or whatever the right thing to do is ?

Regards,  Peter

-- 
Peter Billam       www.pjb.com.au    www.pjb.com.au/comp/contact.html



More information about the Python-list mailing list