PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, September 18, 2022

[FIXED] Why I can't create a cups connection in my raspberry pi using python?

 September 18, 2022     printing, python, raspberry-pi     No comments   

Issue

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.


Solution

you wouldn't have installed cups instead of pycups?

suggestion:

pip uninstall cups
pip install pycups

and try again



Answered By - studioj
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing