[python-win32] Getting a printer's port
Mike Driscoll
mdriscoll at co.marshall.ia.us
Thu Aug 21 15:15:53 CEST 2008
Roger Upole wrote:
>> Hi all,
>>
>> I am in need of a way to get a printer's port with Python. I can get
>> the name of a printer and the comments field (I think) using
>> win32print.EnumPrinters(), but that's as close as I can get. Most of
>> the printers in my organization are networked through Linux CUPS.
>>
>> Any pointers are appreciated. We have Python 2.4 and the script will
>> run on Windows XP machines.
>>
>> Thanks!
>>
>> Mike
>
> You should be able to get the port using data level 2.
>
> win32print.EnumPrinters(win32print.PRINTER_ENUM_NAME, None, 2)
>
> Roger
>
>
Roger,
Thanks for the quick response. This does work! I was doing almost
exactly the same thing, but I wasn't passing the "PRINTER_ENUM_NAME"
flag. I guess that's what adds the additional information.
Thanks again,
Mike
More information about the python-win32
mailing list