pycups icon indicating copy to clipboard operation
pycups copied to clipboard

1030: The printer or class does not exist

Open carstenblt opened this issue 3 years ago • 5 comments

I cannot get it to print - the printer shows up with getPrinters(), but trying to print a file with

conn.printFile(printer='L805', filename='myfile', title='mytitle' , options={})

results in

cups.IPPError: (1030, 'The printer or class does not exist.')

This is weird. If I supply a printer name that does not exist, I instead get a cups.IPPError: (1280, 'No such file or directory') instead.

I am sure there is some fault on my side, but I can't figure it out. Printing with lp -h myhost -d L805 somefile works as expected though.

Some more details: The CUPS server is in another subnet than the printer and client, connected through a VPN.

Pycups somehow wants to call the printer via its URI, which fails. First it queries the printer via its correct address, which succeeds, then the second request fails:

D [28/Feb/2021:15:48:47 +0000] [Client 48] 2.0 Get-Printer-Attributes 55
D [28/Feb/2021:15:48:47 +0000] Get-Printer-Attributes ipp://localhost:631/printers/L805
D [28/Feb/2021:15:48:47 +0000] [Client 48] Returning IPP successful-ok for Get-Printer-Attributes (ipp://localhost:631/printers/L805) from 192.168.1.206.
...
D [28/Feb/2021:15:48:47 +0000] [Client 48] 2.0 Get-Printer-Attributes 56
D [28/Feb/2021:15:48:47 +0000] Get-Printer-Attributes socket://epsonl805
D [28/Feb/2021:15:48:47 +0000] Get-Printer-Attributes client-error-not-found: The printer or class does not exist.
D [28/Feb/2021:15:48:47 +0000] [Client 48] Returning IPP client-error-not-found for Get-Printer-Attributes (socket://epsonl805) from 192.168.1.206.

carstenblt avatar Feb 27 '21 22:02 carstenblt

Even on the same subnet. lp ... works, pycups does not.

carstenblt avatar Mar 04 '21 16:03 carstenblt

Hello @carstenblt

I got the same error, and I make it work with

import cups
cups.setServer("host:port")
cups.Connection(host, port)

Currently, I don't why the above is necessary. hope it helps you out

hugho-ad avatar Oct 22 '21 15:10 hugho-ad

after several tests

the solution that work for me was

cups.setServer(host)
cups.setPort(port)
conn = cups.Connection(host, port)

see http://nagyak.eastron.hu/doc/system-config-printer-libs-1.2.4/pycups-1.9.51/html/cups.Connection-class.html

hugho-ad avatar Oct 22 '21 16:10 hugho-ad

Hi @hugho-ad ,

does the cups.Connection() work for you without the arguments? (I expect you connect to the local cupsd, not remote and you use default CUPS settings - port 631 and localhost).

I've tried the following code (based on examples/cupstree.py):

import cups
c = cups.Connection()
c.printFile(printer='test', filename='/etc/fstab', title='mytitle', options={})

and it worked.

zdohnal avatar Nov 16 '23 06:11 zdohnal

In case you connect to remote CUPS:

import cups
cups.setServer(host)
c = cups.Connection()
c.printFile(printer='test', filename='/etc/fstab', title='mytitle', options={})

zdohnal avatar Nov 16 '23 07:11 zdohnal