opening sys.stdout in binary mode on Windows?

piet at cs.uu.nl piet at cs.uu.nl
Thu Oct 18 11:59:53 CEST 2001


>>>>> Bill Janssen <janssen at parc.xerox.com> (BJ) writes:

BJ> Hi.
BJ> On Windows, I'd like to have stdout opened in binary mode before
BJ> writing to it.  I've tried things like

BJ>    sys.stdout = os.fdopen(sys.stdout.fileno(), "wb")

BJ> without success.  Anyone know the trick?

msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list