Skip to content
Advertisement

Get Printer Status Code with win32print

I have read the documentation of win32print which indicates that GetPrinter is the method which is used to obtain the status of the printer. However, this method returns a complete tuple of data and I’m at a loss at to which element indicates the actual status. Any ideas?

(None, 'HP Deskjet F4400', '', 'USB001', 'HP Deskjet F4400 series Class Driver', '', '', None, '', 'winprint', 'RAW', '', None, 1600, 1, 0, 0, 0, 0, 2, 0)

Advertisement

Answer

If you pass Level=2 into GetPrinter it should return a dict. Then you can examine the keys. So, you could do something like:

d = GetPrinter(yourPrinter, 2)
print(d.keys())

And look for ‘status’ in the keys.

> Returns a dictionary containing PRINTER_INFO_* data for level, or returns a tuple of PRINTER_INFO_2 data if no level is passed in.

I suggest using level 2 because that is the default. So it’s actually the level being returned already (just as a tuple).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement