matplotlib & mod_python

kenneth kenneth at
Fri Oct 26 10:50:47 CEST 2007

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

TyperError: Could not convert object to file pointer

Is there a way to to this thing ?

Thank you very much for any suggestion,

More information about the Python-list mailing list