Printer List from CUPS

M

Mike Tammerman

Hi,

I want to get the printer list from CUPS. I found some ways using

lpstat -p and
http://localhost:631/printers

but, these ways require some parsing and I am not sure, if the parsing
works all the time. A pythonic way would be very helpful.

Thanks,
Mike
 
M

Martin Franklin

Mike said:
Hi,

I want to get the printer list from CUPS. I found some ways using

lpstat -p and
http://localhost:631/printers

but, these ways require some parsing and I am not sure, if the parsing
works all the time. A pythonic way would be very helpful.

Thanks,
Mike

Just for fun I tried this on my Fedora core 4 box

[~]$ python
Python 2.4.1 (#1, May 16 2005, 15:19:29)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
so I guess if you are on a redhat based distro there is hope...
 
M

Martin Franklin

Mike said:
I am using Ubuntu. pycups seems to be not existed any more.

Mike

Yeah as I said if you're using a redhat based distro... However you
could try getting the redhat / fedora rpm that provides pycups and
installing it? I would ask on the Ubuntu list, I know they are a very
python friendly bunch :)

Martin
 
D

djw

Mike said:
Hi,

I want to get the printer list from CUPS. I found some ways using

lpstat -p and
http://localhost:631/printers

but, these ways require some parsing and I am not sure, if the parsing
works all the time. A pythonic way would be very helpful.

Thanks,
Mike

The HPLIP project (hpinkjet.sf.net) includes a basic CUPS extension
module in the src/prnt/cupsext directory. Its pretty rough, but it will
return a list of CUPS printers easily enough. I am in the process of
rewriting it in Pyrex and hope to include more complete CUPS API coverage.

-Don
 
M

Mike Tammerman

Thanks, a lot, this helped me so much. It was so easy, to compile,
install and use the cupsext module.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top