Search code examples
python-3.9

How to get all available printer in network


how do i get all the available printer in the network the user has rights for? I tried the following code:

win32print.EnumPrinters(100, None, 1)

But I only got 5 of 20 printer with this line. But for now it is the best result I get.

If I try

win32print.EnumPrinters(win32print.PRINTER_ENUM_NETWORK, None, 1)

I get the error:

pywintypes.error: (16385, 'EnumPrinters', 'No error message is available')

Solution

  • Ok, I got it. I have to use PRINTER_ENUM_CONNECTIONS