[mod_python] matplotlib and mod_python

Rajarshi Guha rguha at indiana.edu
Sun Feb 25 16:51:09 EST 2007

On Mon, 2007-02-26 at 10:18 +1300, Greg Fawcett wrote:
> It would be interesting to see if you could open the file in /tmp and
> copy the contents to your web directory. Or could you create a symlink
> to the /tmp file?

Aah! I should have tried this first.

However doing it now still doesn't work, i.e., no file is copied to my
current directory.

So I tried a simpler solution:

def index(req):                                                                                                                               
    f = open('tmp/junk.txt', 'w')                                                                                                             
    return 'Done'    

Here tmp has permissions:

drwxrwxr-x 2 apache apache 4.0K Feb 23 22:10 tmp

This works for some PHP scripts I have which have to write image files
to a local (to the current directory) tmp directory.

However when I call the above code from my browser, the file junk.txt is
written to /tmp (i.e. the value of HOME that I set at Apache startup).

Is there something special that needs to be done to get mod_python code
to write to a disk file?

I'm running mod_python 3.1, Apache 2.2, Fedora Core 5, python 2.4


Rajarshi Guha <rguha at indiana.edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
All power corrupts, but we need electricity.

More information about the Mod_python mailing list