[mod_python] relative paths in psp

Noel Taylor nttaylor at cs.uchicago.edu
Thu Jun 3 18:29:46 EDT 2004

Hello all,

I'm trying to embed python in html using mod_python.

I've gotten it up and running successfully, but I have a question about
opening files and relative paths from within the embedded python script.

If myfile.psp is as follows:

f = open('insertthis.html','rb').read()

I get a "no such file" error on 'insertthis.html', which is not such a
mystery since displaying sys.path reveals it as:


So I can make the above code work if I use an absolute path, but is there
any way to make it work using a relative path, where '.' is understood to
be the directory where the .psp file is located?

with thanks,


More information about the Mod_python mailing list