pycups icon indicating copy to clipboard operation
pycups copied to clipboard

getPrinters not working (getDefault does)

Open yarons opened this issue 5 years ago • 4 comments

I've encountered the following:

>>> printers = conn.getPrinters()
>>> print(printers)
{}
>>> printers = conn.getDefault()
>>> print(printers)
Citizen_CL-S621Z
>>> 

Am I doing something wrong? Anything else I can provide in order to fix this?

yarons avatar Dec 13 '20 10:12 yarons

Hi,

it depends what your cupsd daemon returns - I expect you run on localhost, so then check outputs of lpstat -a and lpoptions commands.

If the result is the same as cups module provided (no print queues seen when you did lpstat -a, and showing data for Citizen_CL-S621Z as output of lpoptions), then your CUPS setup is corrupted.

zdohnal avatar Dec 14 '20 13:12 zdohnal

It's remote, can I run lpstat remotely?

yarons avatar Dec 14 '20 13:12 yarons

lpstat -h, see man lpstat

zdohnal avatar Dec 14 '20 13:12 zdohnal

I've connected to the cups docker instance (docker exec -ti 1 bash in my case).

And ran the following:

# lpstat -a
Citizen_CL-S621Z accepting requests since Tue 08 Dec 2020 11:16:25 AM UTC

And then:

# lpoptions
copies=1 device-uri=socket://10.0.0.37:9100 finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=0 number-up=1 printer-commands=none printer-info='Citizen CL-S621Z' printer-is-accepting-jobs=true printer-is-shared=false printer-is-temporary=false printer-location=Lab printer-make-and-model='CITIZEN Barcode Printer' printer-state=3 printer-state-change-time=1607426185 printer-state-reasons=none printer-type=2265156 printer-uri-supported=ipp://localhost/printers/Citizen_CL-S621Z

So I guess it's fine in that perspective, am I doing something wrong? Thanks.

yarons avatar Dec 15 '20 18:12 yarons