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:
https://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”
-
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] -
-
thanks.
UPD:
I just updated CUPS from SVN and it did not help any.[code]
emerge -v pycupsThese are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild N ] dev-python/pycups-1.9.61 USE=”-doc -examples” 0 kBTotal: 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]
-
[…] why not just use pycups or pkipplib? pycups is tightly coupled with CUPS itself. You need to have CUPS binaries installed […]
-
[…] 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 […]
-
Hello, I get the following errors when building againt cups-devel-1.4.2-67.el6.x86_64 on Red Hat Enterprise Linux Server release 6.6 (Santiago) python 3.4.2.
Cheers,
Gav…
cupsmodule.c:1315: error: âIPP_OP_RELEASE_HELD_NEW_JOBSâ undeclared (first use in this function)cupsmodule.c:1316: error: âIPP_OP_DEACTIVATE_PRINTERâ undeclared (first use in this function)
…-
Peter
Hi, I’ve been installing cups with pycups without an issue for a couple months, but since early December, we’ve been running into this issue when we perform the command: sudo pip install pycups.
A lot of errors appear similar to this:
cupsmodule.c:1282:3: error: âIPP_OP_PRINT_URIâ undeclared
cupsmodule.c:1284:3: error: âIPP_OP_CREATE_JOBâ undeclaredetc. etc. The errors seem to all have to do with IPP_OP_something something.
Any assistance would be greatly appreciated.
-
-
Hi Tim,
Thanks for that – any ideas when we will see a 1.9.71 release on pypi?
Cheers,
Gav -
-
-
Hey Tim,
Sorry still getting IPP_ undeclared problems with pycups 1.7.1 (same config as above)
Running setup.py bdist_wheel for pycups
Destination directory: /home/gavinj/wheelhouse
Complete output from command /home/gavinj/pyvenv_libtest/bin/python3 -c “import setuptools;__file__=’/home/gavinj/pyvenv_libtest/build/pycups/setup.py’;exec(compile(open(__file__).read().replace(‘\r\n’, ‘\n’), __file__, ‘exec’))” bdist_wheel -d /home/gavinj/wheelhouse:
running bdist_wheelrunning build
running build_ext
building ‘cups’ extension
creating build
creating build/temp.linux-x86_64-3.4
gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -I/usr/include/expat21 -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DVERSION=”1.9.71″ -I/home/gavinj/pyvenv_libtest/include -I/usr/include/python3.4m -c cupsmodule.c -o build/temp.linux-x86_64-3.4/cupsmodule.o
cupsmodule.c: In function âPyInit_cupsâ:
cupsmodule.c:1350: error: âIPP_UPGRADE_REQUIREDâ undeclared (first use in this function)
cupsmodule.c:1350: error: (Each undeclared identifier is reported only once
cupsmodule.c:1350: error: for each function it appears in.)
cupsmodule.c:1446: error: âIPP_CANCEL_DOCUMENTâ undeclared (first use in this function)
cupsmodule.c:1447: error: âIPP_GET_DOCUMENT_ATTRIBUTESâ undeclared (first use in this function)
cupsmodule.c:1448: error: âIPP_GET_DOCUMENTSâ undeclared (first use in this function)
cupsmodule.c:1449: error: âIPP_DELETE_DOCUMENTâ undeclared (first use in this function)
cupsmodule.c:1450: error: âIPP_SET_DOCUMENT_ATTRIBUTESâ undeclared (first use in this function)
cupsmodule.c:1451: error: âIPP_CANCEL_JOBSâ undeclared (first use in this function)
cupsmodule.c:1452: error: âIPP_CANCEL_MY_JOBSâ undeclared (first use in this function)
cupsmodule.c:1453: error: âIPP_RESUBMIT_JOBâ undeclared (first use in this function)
cupsmodule.c:1454: error: âIPP_CLOSE_JOBâ undeclared (first use in this function)
cupsmodule.c:1455: error: âIPP_IDENTIFY_PRINTERâ undeclared (first use in this function)
error: command ‘gcc’ failed with exit status 1
-
-
-
-
-
Seeing a massive number of the “undeclared (first use in this function)” errors when building on:
Red Hat Enterprise Linux Server release 7.1 (Maipo)
cups-libs-1.6.3-17.el7_1.1.x86_64
cups-devel-1.6.3-17.el7_1.1.x86_64
python-2.7.5-18.el7_1.1.x86_64
python-devel-2.7.5-18.el7_1.1.x86_64
Sample:
$ python setup.py build
running build
running build_ext
building ‘cups’ extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong –param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DVERSION=”1.9.72″ -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:600:3: warning: âppdSetConformanceâ is deprecated (declared at /usr/include/cups/ppd.h:414) [-Wdeprecated-declarations]
ppdSetConformance (level);
^
cupsmodule.c: In function âinitcupsâ:
cupsmodule.c:1181:22: error: âHTTP_STATUS_ERRORâ undeclared (first use in this function)
INT_CONSTANT_ALIAS(HTTP_STATUS_##name, “HTTP_”#name)
^
cupsmodule.c:1116:51: note: in definition of macro âINT_CONSTANT_ALIASâ
PyDict_SetItemString (d, #name, PyInt_FromLong (name)); \
^
cupsmodule.c:1187:3: note: in expansion of macro âINT_HTTP_STATUS_CONSTANTâ
INT_HTTP_STATUS_CONSTANT (ERROR);
^
cupsmodule.c:1181:22: note: each undeclared identifier is reported only once for each function it appears in
INT_CONSTANT_ALIAS(HTTP_STATUS_##name, “HTTP_”#name)
^
cupsmodule.c:1116:51: note: in definition of macro âINT_CONSTANT_ALIASâ
PyDict_SetItemString (d, #name, PyInt_FromLong (name)); \
^
Thank you for pycups. I’ve had a good time with it for the past few days. I am working on a small project that archives local print jobs for retrieval and analysis. To this end, I found a Redhat email post by you on “CUPS Configuration: Get-Notifications”.
Could you please take some time to elaborate on `Connection.createSubscription()` method?
Specifically, what do the parameters `uri`, `recipient_uri`, and `events` mean?
-
Hi,
As pycups is simply a wrapper around libcups, the best thing to look for is the CUPS documentation.
If you can’t find what you need there, as CUPS is an implementation of IPP the next step is the IPP specification.
Here’s a start for CUPS:
http://www.cups.org/documentation.php/spec-ipp.html#CREATE_PRINTER_SUBSCRIPTION
Hi Tim,
Thank you for pycups. I use it in several software and it’s work perfectly.
I have a question. Is there a way to print several file if I want to specify different option (to change paper bac for example) for each file ?
Perhaps cups.Connection.printFiles function reply to my question but how to specify options for 1rst document, options for second document, …
Thank’s by advance for your answer.
Have a good day.
Gael
Hi Tim,
thank you for pycups. i want to know how to use pycups,but i can’t open the website of the document?can you help me ?