[mod_python] ImportError: No module named mod_python.apache

Lex Berezhny LBerezhny at DevIS.com
Sun Dec 22 19:04:34 EST 2002


heya,

>   Is there any simple way to get mod_python to print out its sys.path?

i found a way to answer my first question (after looking through the
mod_python mailing list archive i found an email by Conrad Steenberg
suggesting strace). I had to adapt his example to work on my machine:

i started apache:
# ./apachectl -k start -DONE_PROCESS

then i got the process id and ran strace like so:
$ strace -p 29405

Every time I went to the URL of my script strace printed out the
following:

......
stat64("/usr/lib/python2.2/mod_python", 0xbfffeb30) = -1 ENOENT (No such
file or directory)
open("/usr/lib/python2.2/mod_python.so", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/usr/lib/python2.2/mod_pythonmodule.so", O_RDONLY|O_LARGEFILE) =
-1 ENOENT (No such file or directory)
open("/usr/lib/python2.2/mod_python.py", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
open("/usr/lib/python2.2/mod_python.pyc", O_RDONLY|O_LARGEFILE) = -1
ENOENT (No such file or directory)
....

For some reason mod_python uses the wrong python install directory (i
have two, one that came with my redhat system under /usr/lib/python2.2
and one that i install as part of my script /usr/local/lib/python2.2).

So, where does mod_python make the decision on which python to use?
Again my ./configure for mod_python was this:

./configure --with-apxs=/usr/local/apache2/bin/apxs
--with-python=/usr/local/bin/python2.2

> What could cause an incorrect import path? Any suggestions on resolving
> this?

Thanks again,
 - lex




More information about the Mod_python mailing list