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.

I work on this module as part of my job at Red Hat.

Download

Download tarball releases from:
http://cyberelk.net/tim/data/pycups/

or from the Python Package Index:
http://pypi.python.org/pypi/pycups

Source Code

Fetch the source like this:

git clone git://git.fedorahosted.org/git/pycups.git

or browse it using gitweb.

New releases are announced at freshmeat.

Documentation

Documentation is produced using epydoc and hosted at the pycups PyPI page.

Bug Reporting

Report bugs using the trac interface.

Discussion

Discussion of pycups is welcome on the system-config-printer mailing list.

69 Responses to “pycups”

  1. Dmitri says:

    can someone help me out?
    http://forums.gentoo.org/viewtopic-t-931628.html
    I can not figure out how to fix it.
    [code]
    building 'cups' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    x86_64-pc-linux-gnu-gcc -pthread -march=core2 -mtune=generic -Os -pipe -msse3 -msse4 -mcx16 -msahf -mpopcnt -DVERSION="1.9.61" -fPIC -DVERSION="1.9.61" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
    cupsmodule.c: In function 'cups_ppdSetConformance':
    cupsmodule.c:413:3: warning: 'ppdSetConformance' is deprecated (declared at /usr/include/cups/ppd.h:414) [-Wdeprecated-declarations]
    cupsmodule.c: In function 'initcups':
    cupsmodule.c:853:3: error: 'CUPS_SERVER_REMOTE_PRINTERS' undeclared (first use in this function)
    cupsmodule.c:853:3: note: each undeclared identifier is reported only once for each function it appears in
    error: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1
    [/code]

  2. Dmitri says:

    net-print/cups-1.6.0 USE=”X acl dbus filters pam python ssl threads usb -avahi -debug -gnutls -java -kerberos (-selinux) -static-libs -systemd -xinetd -zeroconf”

  3. Dmitri says:

    thanks.
    UPD:
    I just updated CUPS from SVN and it did not help any.

    [code]
    emerge -v pycups

    These are the packages that would be merged, in order:

    Calculating dependencies... done!
    [ebuild N ] dev-python/pycups-1.9.61 USE="-doc -examples" 0 kB

    Total: 1 package (1 new), Size of downloads: 0 kB

    >>> Verifying ebuild manifests

    >>> Emerging (1 of 1) dev-python/pycups-1.9.61
    * pycups-1.9.61.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ]
    >>> Unpacking source...
    >>> Unpacking pycups-1.9.61.tar.bz2 to /var/tmp/portage/dev-python/pycups-1.9.61/work
    >>> Source unpacked in /var/tmp/portage/dev-python/pycups-1.9.61/work
    >>> Preparing source in /var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61 ...
    >>> Source prepared.
    >>> Configuring source in /var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61 ...
    >>> Source configured.
    >>> Compiling source in /var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61 ...
    python2.7 setup.py build
    running build
    running build_ext
    building 'cups' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    x86_64-pc-linux-gnu-gcc -pthread -march=core2 -mtune=generic -Os -pipe -msse3 -msse4 -mcx16 -msahf -mpopcnt -DVERSION="1.9.61" -fPIC -DVERSION="1.9.61" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
    cupsmodule.c: In function ‘cups_ppdSetConformance’:
    cupsmodule.c:413:3: warning: ‘ppdSetConformance’ is deprecated (declared at /usr/include/cups/ppd.h:414) [-Wdeprecated-declarations]
    cupsmodule.c: In function ‘initcups’:
    cupsmodule.c:853:3: error: ‘CUPS_SERVER_REMOTE_PRINTERS’ undeclared (first use in this function)
    cupsmodule.c:853:3: note: each undeclared identifier is reported only once for each function it appears in
    error: command 'x86_64-pc-linux-gnu-gcc' failed with exit status 1
    * ERROR: dev-python/pycups-1.9.61 failed (compile phase):
    * Building failed
    *
    * Call stack:
    * ebuild.sh, line 85: Called src_compile
    * environment, line 5288: Called distutils_src_compile
    * environment, line 1296: Called die
    * The specific snippet of code:
    * "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed";
    *
    * If you need support, post the output of `emerge --info '=dev-python/pycups-1.9.61'`,
    * the complete build log and the output of `emerge -pqv '=dev-python/pycups-1.9.61'`.
    * The complete build log is located at '/var/tmp/portage/dev-python/pycups-1.9.61/temp/build.log'.
    * The ebuild environment file is located at '/var/tmp/portage/dev-python/pycups-1.9.61/temp/environment'.
    * Working directory: '/var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61'
    * S: '/var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61'

    >>> Failed to emerge dev-python/pycups-1.9.61, Log file:

    >>> '/var/tmp/portage/dev-python/pycups-1.9.61/temp/build.log'

    * Messages for package dev-python/pycups-1.9.61:

    * ERROR: dev-python/pycups-1.9.61 failed (compile phase):
    * Building failed
    *
    * Call stack:
    * ebuild.sh, line 85: Called src_compile
    * environment, line 5288: Called distutils_src_compile
    * environment, line 1296: Called die
    * The specific snippet of code:
    * "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed";
    *
    * If you need support, post the output of `emerge --info '=dev-python/pycups-1.9.61'`,
    * the complete build log and the output of `emerge -pqv '=dev-python/pycups-1.9.61'`.
    * The complete build log is located at '/var/tmp/portage/dev-python/pycups-1.9.61/temp/build.log'.
    * The ebuild environment file is located at '/var/tmp/portage/dev-python/pycups-1.9.61/temp/environment'.
    * Working directory: '/var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61'
    * S: '/var/tmp/portage/dev-python/pycups-1.9.61/work/pycups-1.9.61'

    [/code]

  4. Dmitri says:

    pycups successfully compiled with cups-1.5.3

  5. […] why not just use pycups or pkipplib? pycups is tightly coupled with CUPS itself. You need to have CUPS binaries installed […]

  6. […] enable Airprint, we will use the airprint-generate.py. For this, we also need the pycups library. I have used version 1.9.62 but I guess that newer version will also […]

Leave a reply

Comments are moderated. Comments that are inappropriate, offensive, vulgar, badly written or insulting will be deleted or edited to make the author look silly.