[mod_python] cannot import mod_python.apache error

ganapathy murali krishnan gmurali at cs.uchicago.edu
Fri Jan 31 16:37:40 EST 2003

The python library directories are readable and executable by "all".
More curiously, I created a mptest.py as suggested by the mod_python 
test, and it gave me the same error.

I then proceeded to remove the "from mod_python import apache" statement 
from mptest.py, figuring that in that sample code, all it wanted was the 
value "apache.OK". Removing the import statement and replacing 
"apache.OK" with 0 (its value as read from the actual apache.py file),
did not help! It still gave me the same error. So it looks as if 
mod_python.so is trying to import mod_python.apache, and it is triggered
every time I try to serve up a .py file.

I also confirmed that sys.path has the lib/python-2.3/site-packages 
(running python from command line).

I will try to see if strace can give me some information.

- Murali

Mongryong wrote:
> Have you checked out the FAQ section?
> Every newbie runs into this problem.  It's most likely because Apache
> does not  have permission to access python's lib directory.
> Try starting Apache with root access if you can.  Check, the "user"
> paremeter in httpd.conf.  Make sure the "user" is somebody who can
> access python's lib directory.

More information about the Mod_python mailing list