[mod_python] importing from a PSP file

Simon Wittber simonwittber at gmail.com
Thu Jan 6 19:52:13 EST 2005

> > I don't know if this will help you or not, but mod_python actually uses
> > subinterpreters, each of which have their own namespace separate from the
> > main interpreter.

Brilliant! Just what I need.

> In short, requests against the directory and a file in the directory map
> to different interpreters when they should be the same. This makes it
> hard to have a default index page served up when directory is accessed.

Fortunately we do not use index.psp files, so it seems this bug won't effect us.

To summarise:

The final 3 lines I added after line 207 in psp.py are:

cwd = os.path.split(self.filename)[0]
if cwd not in sys.path:

This allows (along with the PythonInterpPerDirectory driective)
multiple developers, on the same machine, to import different packages
(which reside in the same folder as the .psp file) of the same name
into .psp pages which are served from their public_html folders.

Thanks for the assistance.


More information about the Mod_python mailing list