Printer List from CUPS

Discussion in 'Python' started by Mike Tammerman, Sep 8, 2005.

  1. 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
    Mike Tammerman, Sep 8, 2005
    #1
    1. Advertising

  2. Mike Tammerman wrote:
    > 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.
    >>> import pycups
    >>>


    so I guess if you are on a redhat based distro there is hope...
    Martin Franklin, Sep 8, 2005
    #2
    1. Advertising

  3. I am using Ubuntu. pycups seems to be not existed any more.

    Mike
    Mike Tammerman, Sep 8, 2005
    #3
  4. Mike Tammerman wrote:
    > 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
    Martin Franklin, Sep 8, 2005
    #4
  5. Mike Tammerman

    djw Guest

    Mike Tammerman wrote:
    > 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
    djw, Sep 8, 2005
    #5
  6. Thanks, a lot, this helped me so much. It was so easy, to compile,
    install and use the cupsext module.

    -Mike
    Mike Tammerman, Sep 12, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. freefly_xml
    Replies:
    0
    Views:
    482
    freefly_xml
    May 1, 2006
  2. Russell Lear

    CUPS or IPP in Python?

    Russell Lear, Mar 7, 2004, in forum: Python
    Replies:
    0
    Views:
    838
    Russell Lear
    Mar 7, 2004
  3. Jerome Alet
    Replies:
    0
    Views:
    652
    Jerome Alet
    May 19, 2006
  4. mtp
    Replies:
    1
    Views:
    5,051
  5. Graham Jenkins

    cups.Connection.printFile

    Graham Jenkins, Sep 16, 2008, in forum: Python
    Replies:
    4
    Views:
    862
    Tim Golden
    Sep 29, 2008
Loading...

Share This Page