matplotlib & mod_python

kenneth kenneth at inwind.it
Fri Oct 26 04:50:47 EDT 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
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




More information about the Python-list mailing list