[mod_python] Import Issues

Tommy !! the_edge2020 at hotmail.com
Sun Apr 6 03:53:44 EST 2003

Hi all,

Just curious as to why (by design?) mod_python does not allow one to import 
modules in the same directory as the executing script - instead you have to 
resort to altering sys.path inside each script in order to get it importing 

This is an issue if you don't have access to the web server to modify 
httpd.conf and .htaccess files are disabled/limited. Additionally, I may not 
have access to the site-packages directory, or any other directory, for that 
matter, from which my script could import reusable components.

I find this makes it really awkward to code anything above a single file 
Python script (e.g. I'm using a session handling mechanism specific to a 
single web application). Using os.getcwd() seems to indicate that the cwd 
when executing a script with mod_python is my Apache2 directory.

This behaviour occurs on Apache 2.0.43, mod_python 3.0.3, Linux AND Windows.

Am I missing something simple?

Excuse me if this didn't make much sense, it's 4am here :)

Thanks in advance.

Tom L

Hotmail now available on Australian mobile phones. Go to  

More information about the Mod_python mailing list