matplotlib & mod_python

Discussion in 'Python' started by kenneth, Oct 26, 2007.

  1. kenneth

    kenneth Guest

    Hi all.

    I would like to use a "combination" of matplotlib and mod_python to
    create a
    PNG figure on the fly in my web site.
    The mod_python handler code should be something like this:


    def handler(req):

    fig = Figure()
    ...
    ... figure creation stuff
    ...
    canvas = FigureCanvasAgg(fig)
    canvas.print_figure(req, dpi=72)

    return apache.OK


    This code gives me an error as req is not a file-like instance (as
    sys.stdout):

    TyperError: Could not convert object to file pointer

    Is there a way to to this thing ?

    Thank you very much for any suggestion,
    Paolo
     
    kenneth, Oct 26, 2007
    #1
    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. John Hunter
    Replies:
    0
    Views:
    342
    John Hunter
    Aug 26, 2003
  2. John Hunter
    Replies:
    0
    Views:
    380
    John Hunter
    Oct 21, 2003
  3. Pekko Piirola

    Animations with matplotlib?

    Pekko Piirola, Nov 26, 2003, in forum: Python
    Replies:
    1
    Views:
    992
    John Hunter
    Nov 26, 2003
  4. Dr. Colombes
    Replies:
    3
    Views:
    698
    John Hunter
    Feb 23, 2005
  5. blbmdsmith
    Replies:
    1
    Views:
    682
    Graham Dumpleton
    Dec 14, 2006
Loading...

Share This Page