[mod_python] Current Working Directory not set?

Deron Meranda deron.meranda at gmail.com
Fri Jan 27 15:34:42 EST 2006

There are two problems with having the working directory set like you want

1. URLs don't have to map to actual directories (and many mod_python
users depend on this)

2. The working directory is a process attribute.  Changing it would
cause all kinds of problems in a multithreaded environment (depending
on your Apache MPM)

Generally, you should either set your PythonPath, or expect to deal
with absolute pathnames or other such games.

You may also want to look at the mod_python import_module() function,
which lets you specify a path.  Also the request member req.filename
may be useful to you was well.
Deron Meranda

More information about the Mod_python mailing list