pywin32print printer info levels: Expose more PRINTER_INFO_* constants
using Python 3.11.5, pywin32 306
Hi pywin32,
I am currently building a kind of photobooth where I am using a canon selphy printer which works great in combination with win32print but to make the photobooth a lot more error proof I would like to access the PRINTER_INFO_2 stucture to be able to look if there are any errors. But only PRINTER_INFO_1 is accessible I don't know enough of python library creation to come with an advise how to implement it.
Info
using Python 3.11.5, pywin32 306
import win32print
printer_name = win32print.GetDefaultPrinter()
printer_open = win32print.OpenPrinter(printer_name)
printer_info = win32print.GetPrinter(printer_open,win32print.PRINTER_INFO_1)
print(printer_info)
works no problem but then I try with PRINTER_INFO_2 and it breaks
import win32print
printer_name = win32print.GetDefaultPrinter()
printer_open = win32print.OpenPrinter(printer_name)
printer_info = win32print.GetPrinter(printer_open,win32print.PRINTER_INFO_1)
print(printer_info)
Traceback (most recent call last):
File "e:\HBO-ICT\git\Personal-Storage\cognizant\printerAIPhotobooth\python\pdfprint.py", line 4, in <module>
printer_info = win32print.GetPrinter(printer_open,win32print.PRINTER_INFO_2)
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'win32print' has no attribute 'PRINTER_INFO_2'. Did you mean: 'PRINTER_INFO_1'?
Request
- Can the different levels of info be added?
Thanks in advance!
The 2nd param is an integer with the level - we support 1,2,3,4,5,7,8,9. I agree we should expose them as constants though.