[python-win32] faster way to get printer status?
Alec Bennett
whatyoulookin at yahoo.com
Tue Aug 4 23:04:43 CEST 2009
I'm trying to get the online/offline status of a printer, and using WMI I'm finding it very slow. Here's the code I'm working, maybe there's some way to opimize it? Or some other way? I'm able to use win32print to query the status of an online printer, but not to find out whether its online or not (its pStatus always returns 'Idle').
def check_printer(printer_name):
.....c = wmi.WMI ()
.....for p in c.Win32_Printer():
..........if p.caption == printer_name:
...............if p.WorkOffline:
..................print "its offline"
...............else:
..................print "its online"
More information about the python-win32
mailing list