tjfontaine / airprint-generate

Automatically generate AirPrint Avahi service files for CUPS printers
http://www.atxconsulting.com/blog/tjfontaine/2010/11/21/automatically-generate-airprint-avahi-service-files-cups-printers
400 stars 119 forks source link

cups.IPPError: (1280, 'Success') #25

Open paulwarwicker opened 3 years ago

paulwarwicker commented 3 years ago

I am trying to run this from a Windows host running Docker/WSL2. The docker image is built and is run with the command below. There is some output from the printer (two blank sheets and a lead sheet) which suggests that contact is made from the script using an HTTP post from CUPS. This is mentioned on the lead sheet.

PS C:\opt\sw\src\repos\airprint-generate> docker run --rm -it -v C:\opt\sw\src\repos\airprint-generate:/tmp airprint-generate:latest -H 192.168.1.1 -P 9100 -d /tmp
Traceback (most recent call last):
  File "./airprint-generate.py", line 279, in <module>
    apg.generate()
  File "./airprint-generate.py", line 124, in generate
    printers = conn.getPrinters()
cups.IPPError: (1280, 'Success')
PS C:\opt\sw\src\repos\airprint-generate>

Any comment?

Thanks -paul

dossy commented 3 years ago

I don't do much with Windows/WSL, so I haven't seen this particular error, but CUPS IPP error 1280 is a CUPS internal server error, so you'll want to look in the CUPS server error log (/var/log/cups/error_log) to see what the error is.

paulwarwicker commented 3 years ago

When I dug further, CUPS is not actually installed. The printer is connected by USB to a router running OpenWRT, and CUPS is not recommended. It has its own printer server, p910nd.

I did manage to get the script working by installing CUPS on a separate VM which runs 24x7. The VM now has a printer defined to use the printer over port 9100 on the router. The VM is also running avahi-daemon and is announcing the printer using the service definition from the script.

Unfortunately, despite tools such as avahi-browse and avahi-discover can see these printers, my iOS devices claim that no AirPrint printers can be found. But that appears to be a problem unrelated to the running of this script.

Coincidentally, I got exactly the same error when running against the CUPS server. Just to clarify, I had to configure CUPS to be able to connect from any host (the default is the local server only) and secondly, to disable the access control in order for the script to complete. However, because the avahi-daemon was running under systemctl, there were no logs to inspect. You had to use systemctl to see any daemon output.

Thanks anyway. Although I still don't have a working AirPrint printer, you made me question my setup.

-paul