Author lopgok
Recipients lopgok
Date 2008-12-07.02:40:08
SpamBayes Score 7.45952e-09
Marked as misclassified No
Message-id <>
I have a program that needs to output binary data to stdout.
I don't want to convert it to a string.

for example something like
to write a byte with all the bits turned on.

When I try this, I get an error like:
  File "/usr/local/lib/python3.0/", line 1484, in write
TypeError: can't write bytes to text stream

I know I can open a file in 'wb' mode and write to it, but what
I want to do is somehow switch the mode of stdout to 'wb' mode.
I read lots of python 3 documentation, as well as searched without
finding a way.
Date User Action Args
2008-12-07 02:40:11lopgoksetrecipients: + lopgok
2008-12-07 02:40:10lopgoksetmessageid: <>
2008-12-07 02:40:09lopgoklinkissue4571 messages
2008-12-07 02:40:08lopgokcreate