pycups

This page is about the Python bindings for the CUPS API, known as pycups. It was written for use with system-config-printer, but can be put to other uses as well.

Download

Download tarball releases from the Python Package Index:
http://pypi.python.org/pypi/pycups

or older releases from:
http://cyberelk.net/tim/data/pycups/

Source Code

The git repository is available at GitHub.

Bug Reporting

Report issues using GitHub.

Comments

86 responses to “pycups”

  1. Gowtham avatar
    Gowtham

    Thanks for pointing out these issues.
    Modified the fgets code to avoid compiler warnings and also removes the new line character that comes along with fgets.

    I cleanup with the commit history to push to github earlier. I shouldn’t have done that. I overwrote my previous commits to keep the index intact. I lost some of the interim commits(No big deal!)
    https://github.com/narisipalli/pycups/commits/

    Heres the full commit of my changes-
    https://github.com/narisipalli/pycups/commit/4a857c31a40222b7c78e732d2a1769348039b06e

  2. tim avatar

    Thanks, merged.

  3. Gowtham avatar
    Gowtham

    Thanks. When are you planning to push the tar of the new version 1.9.58?

  4. tim avatar

    I’ll probably get to it this week.

  5. tim avatar

    macaronij: the new 1.9.58 release is now registered at PyPI and the documentation is there as well. See links in the main page, above.

  6. Ladislav Hagara avatar
    Ladislav Hagara

    $ gpg –verify pycups-1.9.58.tar.bz2.asc
    gpg: Signature made Tue Jul 26 13:28:58 2011 CEST using RSA key ID F4DE942C
    gpg: BAD signature from “Tim Waugh “

  7. Ladislav Hagara avatar
    Ladislav Hagara

    I had to update Makefile for Source Mage GNU/Linux. You changed in this version ln -sf to mv for cups.so, I had to change it back.

    sed -i ‘s:mv build/lib:ln -sf build/lib:’ Makefile

    Source Mage commit:
    http://scmweb.sourcemage.org/gitweb.cgi?p=smgl/grimoire.git;a=commitdiff;h=d831437ebbebfa020aa4176058f8c565e1a41908;hp=f31d661af73c9265c983523514dc615d60eb0e16

  8. tim avatar

    GPG signature fixed: the signature I still had here on disk was the same, most likely a memory issue that was fixed in the last few weeks.

    I’ve applied your other change.

  9. Philippe avatar
    Philippe

    I tried posting a ticket on trac but there’s no registration page ?

    Anyway, requested_attributes doesn’t seem to work in Connection.getJobs(). It will always return an empty dict. It works with getJobAttributes though. Let me know if you need more details.

  10. Philippe avatar
    Philippe

    While I’m at it: your software is awesome 🙂 I added print support with full option handling to my django web app in a day of coding. Thanks a bunch!

  11. tim avatar

    The registration is the Fedora Project registration.

    What version of CUPS are you running? That might very well make the difference…

  12. Philippe avatar
    Philippe

    Sorry I forgot to mention: 1.9.51-0ubuntu2
    If that’s fixed in a newer version sorry for bothering, otherwise I’ll open a ticket when I get back at the office on monday.

  13. tim avatar

    That’s a pycups version number; what about CUPS? pycups just returns whatever CUPS tells it to.

  14. Philippe avatar
    Philippe

    cups is 1.4.4-6ubuntu2.3

    I’m using ubuntu 10.04.3 LTS.

  15. paul avatar
    paul

    I seem to be missing some bits. This is on a FreeBSD 8.2 system with cups 1.5.2 installed. I’ll reinstall it in a minute and see if that clears it up. Not sure about the python bindings for avahi which I guess I also need…

    Running pycups-1.9.61/setup.py -q bdist_egg –dist-dir /tmp/easy_install-QdiX77/pycups-1.9.61/egg-dist-tmp-zYalnU
    cupsmodule.c:23:23: error: cups/cups.h: No such file or directory
    cupsmodule.c:24:27: error: cups/language.h: No such file or directory
    In file included from cupsmodule.c:26:
    cupsmodule.h:25:28: error: cups/adminutil.h: No such file or directory
    cupsmodule.h:53:2: error: #error pycups requires CUPS 1.2.x
    In file included from cupsmodule.c:33:
    cupsconnection.h:24:23: error: cups/http.h: No such file or directory
    In file included from cupsmodule.c:33:
    cupsconnection.h:37: error: expected declaration specifiers or ‘…’ before ‘http_t’

  16. paul avatar
    paul

    I left a comment about building this on FreeBSD: turns out its in the ports collection there.

  17. zac avatar

    Thank you for writing this wonderful module. It defiantly will make my time working with printer abstractions in UNIX much easier for my program.

    Question though: is there any attribute or method to find what is marked as the default printer with? All I could find in the documentation about it is CUPS_PRINTER_DEFAULT, but I’m not sure where this is exposed in the actual printer attribute list.

  18. tim avatar

    cups.Connection.getDests() returns a dict whose values each have an is_default attribute. That will reflect the user’s personal default setting.

    To find out which is the default printer for a given server, examine the ‘printer-type’ attribute in the return value of cups.Connection.getPrinterAttributes(): it is a bitmap, and CUPS_PRINTER_DEFAULT is one of those bits.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.