Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Is there in 2018 a python3 library that implements the Internet Printing Protocol?
#1
All python libraries that implement the Internet Printing Protocol (IPP) do not seem to work under python3.

Here is what I've tried so far:
  • pkipplib
    import pkipplib.pkipplib        # installed via pip
    Leads to the following error:
    Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/home/user/.local/lib/python3.6/site-packages/pkipplib/pkipplib.py", line 308
            raise KeyError, key
                          ^
    SyntaxError: invalid syntax
  • pyipptool
    import pyipptool        # installed via pip
    Leads to the following error:
    Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/home/user/.local/lib/python3.6/site-packages/pyipptool/__init__.py", line 1, in <module>
            from .config import get_config
        File "/home/user/.local/lib/python3.6/site-packages/pyipptool/config.py", line 1, in <module>
            import ConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'

I use python 3.6.7 on linux.

Thank you and best regards
AFoeee
Quote
#2
You could work with CUPS directly:
https://pypi.org/project/pycups/

#!/usr/bin/python3
import time, pprint, cups
  
conn = cups.Connection()
printers = conn.getPrinters ()
pprint.pprint(printers)
print()
  
printer = conn.getDefault()
print("Default1:", printer)
  
if printer == None:
    printer = list(printers.keys())[0]
    print("Default2:", printer)
  
myfile = "./test.txt"
pid = conn.printFile(printer, myfile, "test", {})
while conn.getJobs().get(pid, None) is not None:
    time.sleep(1)
#done
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Is it possible to trun local internet access off programmatically? Larz60+ 4 747 Sep-25-2018, 08:10 AM
Last Post: DeaD_EyE
  no protocol header version error mjudhandoyo 2 2,773 Feb-03-2017, 10:35 PM
Last Post: nilamo
  accessing SOAP protocol page secured with cetrificad lopow 3 2,416 Jan-11-2017, 03:14 PM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)