[mod_python] mod_python calls the wrong python executable

Graham Dumpleton grahamd at dscpl.com.au
Wed Jul 19 05:58:41 EDT 2006

On 19/07/2006, at 6:30 PM, mvanier wrote:

> I'm trying to run mod_python using the latest mod_python snapshot  
> with apache 2.2 (compiled from source) on Debian Linux.  I've run  
> into a strange error: when I try to run a python script through the  
> server, the wrong python executable gets called.  Here's the apache  
> error log:
> [Wed Jul 19 01:21:25 2006] [error] make_obcallback: could not  
> import mod_python.apache.\n
> ImportError: No module named mod_python.apache
> [Wed Jul 19 01:21:25 2006] [error] make_obcallback: Python path  
> being used "['/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/ 
> lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/ 
> python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/ 
> usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/ 
> PIL', '/var/lib/python-support/python2.4', '/usr/lib/site-python']".
> [Wed Jul 19 01:21:25 2006] [error] get_interpreter: no interpreter  
> callback found.
> [Wed Jul 19 01:21:25 2006] [error] [client]  
> python_handler: Can't get/create interpreter.
> The sys.path of this python interpreter is the one that would exist  
> if /usr/bin/python2.4 (which was installed by Debian) was called  
> instead of the correct one, which (in my case) is /usr/local/ 
> packages/python/bin/python (which I compiled and installed myself  
> from source).  I specified this executable when I configured  
> mod_python (using the --with-python option).  For some reason,  
> though, it isn't getting used.  Any ideas would be appreciated.

At least you triggered the new debug output specifically put into  
3.2.9/3.3 to help debug this sort of problem.

Anyway, try ensuring that you have "/usr/local/paclages/python/bin"  
first in the
PATH environment variable of the user that Apache is run as. If you  
don't and
when Python is initialised in the context of mod_python, it finds  
evidence first
of Python being installed in some other location instead of the one  
you want,
then it will setup sys.path based on the location of that other  
version of Python
and thus not look where you actually installed the Python components of

BTW, does /usr/bin/python or /usr/lib/python2.4 actually exist.


More information about the Mod_python mailing list