Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pywin32print printer info levels: Expose more PRINTER_INFO_* constants #2197

Open
Stijno11 opened this issue Mar 8, 2024 · 1 comment
Open

Comments

@Stijno11
Copy link

Stijno11 commented Mar 8, 2024

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!

@mhammond mhammond changed the title pywin32print printer info levels: Only PRINTER_INFO_1 is accessible pywin32print printer info levels: Expose more PRINTER_INFO_* constants May 27, 2024
@mhammond
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants