[python-win32] win32print.SetPrinter
Kelly Kranabetter
Kelly at JackpineGroup.com
Fri Apr 29 23:18:25 CEST 2005
I'm trying to set the port of a printer (on Windows 98) but it fails if
the devmode of the printer is NULL.
Here is some sample code:
h= win32print.OpenPrinter("Printername")
settings= win32print.GetPrinter(h, 2)
settings["pPortName"]= r"\\newserver\printer"
win32print.SetPrinter(h, 2, settings, 0)
# setprinter fails because devmode is None
# exception thrown is ValueError - PyDEVMODE cannot be None in this
context
I've confirmed with a little C program that the DevMode is definitely
NULL for the printer.
How can I get around this?
Kelly
More information about the Python-win32
mailing list