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
JavaScript
x
5
1
Traceback (most recent call last):
2
File "/home/pi/Thesis/print_usingcups.py", line 2, in <module>
3
conn = cups.Connection()
4
AttributeError: module 'cups' has no attribute 'Connection'
5
I got the code from the internet here’s the code
JavaScript
1
6
1
import cups
2
conn = cups.Connection()
3
printers = conn.getPrinters ()
4
for printer in printers:
5
print (printer, printers[printer]["device-uri"])
6
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.
Advertisement
Answer
you wouldn’t have installed cups instead of pycups?
suggestion:
JavaScript
1
3
1
pip uninstall cups
2
pip install pycups
3
and try again