How to write to printer in Windows?
Randall Hopper
aa8vb at yahoo.com
Wed Apr 19 06:47:29 EDT 2000
Albert Wagner:
|How can I write(aLine) to a printer in Windows? I tried this:
|
|from win32pipe import popen
|:
|self.printer = popen('lpt1' 'w')
|:
|self.printer.write(aLine)
|
|but get a general protection fault. Any help will be greatly
|appreciated.
I see you have a pointer to the win32 printer modules in another reply.
The problem with your above code may be something simple though. From my
DOS days, I seem to recall that 'lpt1:' was the correct name for the
printer device. lpt1 may be trying to write to a file in a directory for
which you don't have permission.
In a DOS box, try 'copy c:\config.sys lpt1:'. That'll make sure you're
printer is attached to that device. If so, you should be able to run your
Python program there with (I would think) the same results.
--
Randall Hopper
aa8vb at yahoo.com
More information about the Python-list
mailing list