Printing from python on Windows platform

Mark Hammond mhammond at
Wed Aug 4 21:07:17 EDT 1999

> Dumb question from a non-Windows person: shouldn't that flag
> arg be "wb"?
> We Unix weenies are always getting beat up by the Windows
> weenies for not
> including the "b"inary flag when opening files.  I figured
> turn about is
> fair play. ;-)

I have no idea at all :-)  We are talking to the printer as a tty device,
so I guess it depends on the printer.

So I guess the "portable" thing do is indeed to open in binary mode, and
send explicit line terminators of your own choosing.  But how do you know
the correct terminator for the printer?  '\r\n' is probably safest for a
printer in TTY mode.

Specifying text mode make some sense on Windows at least - you can send
normal "\n" characters, and they will be translated to "\r\n", which is
likely to be what you want.

[But your original point is taken :-]


More information about the Python-list mailing list