[python-win32] Re: Getting a printer's port

Roger Upole rwupole at msn.com
Wed Aug 20 22:22:58 CEST 2008


Mike Driscoll 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



More information about the python-win32 mailing list