I want to use python code to print to my printer. I installed all the required module but it's not running. The error I got is
Traceback (most recent call last):
File "/home/pi/Thesis/print_usingcups.py", line 2, in <module>
conn = cups.Connection()
AttributeError: module 'cups' has no attribute 'Connection'
I got the code from the internet here's the code
import cups
conn = cups.Connection()
printers = conn.getPrinters ()
for printer in printers:
print (printer, printers[printer]["device-uri"])
my expected output is like this
EPSON_LX-300 usb://EPSON/LX-300+?serial=L010209081
RICOH_Aficio_SP_100 usb://RICOH/
Aficio?serial=T382M977983
but I received an error.
you wouldn't have installed cups instead of pycups?
suggestion:
pip uninstall cups
pip install pycups
and try again