Printing

Peter Hansen peter at engcorp.com
Wed Dec 22 10:28:20 EST 2004


Craig Ringer wrote:
> I don't have a windows box to test with - well, our NT4 server, but it
> doesn't have anything on the serial ports. I would think that one just:
> 
> printerport = open("lpt1","w")
> 
> but on my NT box that results in a file not found exception. lpt0 opens,
> but I have no idea if it works. I did a quick google search and turned
> up little, but I'm sure this has been asked before so you might want to
> try a google groups search, etc.

The above works, provided you have configured the printer
to be addressable that way.  Note that you might well want
to use binary mode ("wb") to avoid newline-mangling.

Python can open "lpt0", but that just creates a file with
that name in your current directory... there is no such
printer port.

-Peter



More information about the Python-list mailing list