[mod_python] matplotlib and mod_python

Rajarshi Guha rguha at indiana.edu
Sun Feb 25 15:58:04 EST 2007


Hi, I have a mod_python based application in which I would like to
generate a chart using matplotlib.

Currently, when I try to call the function that generates the chart I
get a 'HOME not writable' error. I realize why this is happening and so
I modified my apache startup script to export a HOME directory of '/tmp'

When this is done, the chart is generated, but when I try to dump the
chart to a file using:

canvas.print_figure( ... )

the file is always created in /tmp (i.e., the value of HOME), rather
than in the file that I specify (which is in a current directory that is
writable by apache).

Has anybody successfully used matplotlib in a mod_python application, to
actually save a chart to a disk file?

(I realize that one way would be to send back the raw image bytes, but
the image is supposed to be a part of an HTML page, so I can't go down
that path)

Any pointers would be greatly appreciated.

Thanks,

-------------------------------------------------------------------
Rajarshi Guha <rguha at indiana.edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
The Heineken Uncertainty Principle:
You can never be sure how many beers you had last night.




More information about the Mod_python mailing list