Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cups printing
#1
I have a raspberrypi I am using as a print server and it has my HP Officejet on a USB port.
I can print to it from libreoffice, gedit and all other programs I use.
I am trying to use python-cups and am getting an error which puzzles me as I have being using code just copied and pasted
and pointing it to a test file.

import cups
conn = cups.Connection()
printers = conn.getPrinters ()
prin = conn.getDefault()
myfile = "/home/norman/Fred.txt"
conn.printFile (prin, myfile, "Project Report", {})
I am running it from python 3.5.2
The error is
Error:
Traceback (most recent call last): File "./linprint.py", line 6, in <module> conn.printFile (prin, myfile, "Project Report", {}) TypeError: unicode or bytes object required
I cannot find out what is wrong because the error doesn't seem specific enough.
Can someone explain what is wrong and how to fix it please?
Reply


Messages In This Thread
cups printing - by Barrowman - Jan-08-2019, 11:12 PM
RE: cups printing - by heiner55 - May-26-2019, 05:02 PM
RE: cups printing - by cthart - Oct-18-2022, 06:56 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020