[mod_python] PYTHONPATH and mod_python

Martin Stoufer MCStoufer at lbl.gov
Wed Dec 20 14:39:52 EST 2006



Soenke Ruempler - NorthClick wrote:
> Hi,
>
> We're using a managed server and have our own apache + mod_python running.
> All went fine until the server was rebooted by the provider.
>
> Now I get:
>
> [Wed Dec 20 11:22:07 2006] [notice] SIGHUP received.  Attempting to restart
> [Wed Dec 20 11:22:07 2006] [notice] mod_python: Creating 8 session mutexes
> based on 150 max processes and 0 max threads.
> [Wed Dec 20 11:22:07 2006] [notice] mod_python: using mutex_directory
> /www/94219_27474/local/tmp
> [Wed Dec 20 11:22:07 2006] [notice] Apache/2.0.55 (Unix) DAV/2 SVN/1.3.2
> mod_python/3.2.10 Python/2.5 configured -- resuming normal operations
>
>
> [Doing the first HTTP request here]
>
> [Wed Dec 20 11:22:13 2006] [error] make_obcallback: could not import
> mod_python.apache.\n
> ImportError: No module named mod_python.apache
> [Wed Dec 20 11:22:13 2006] [error] make_obcallback: Python path being used
> "['/usr/lib/python25.zip', '/usr/lib/python2.5',
> '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
> '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages',
> '/usr/lib/python2.5/site-packages/PIL']".
> [Wed Dec 20 11:22:13 2006] [error] python_handler: no interpreter callback
> found.
> [Wed Dec 20 11:22:13 2006] [error] [client xxx] python_handler: Can't
> get/create interpreter.
>
> [500 Interal Server Error]
>
> I guess the problem is the PYTHONPATH is being ignored by apache+mod_python.
> Mod_python is installed into some local dir and the PYTHONPATH is set:
>
> # env | grep PY
> PYTHONPATH=/www/94219_27474/local/lib/python2.5/site-packages/:/www/94219_27
> 474/local/lib/svn-python:
>
> The intepreter gets the path from commandline:
>
> # python2.5
> Python 2.5 (r25:51908, Sep 22 2006, 18:03:12)
> [GCC 3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>   
>>>> import sys
>>>> sys.path
>>>>         
> ['', '/www/94219_27474/local/lib/python2.5/site-packages',
> '/www/94219_27474/local/lib/svn-python', '/kunden/94219_27474',
> '/usr/lib/python25.zip', '/usr/lib/python2.5',
> '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
> '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages',
> '/usr/lib/python2.5/site-packages/PIL']
>   
>>>> import mod_python.apache
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "usr/lib/python2.5/site-packages/mod_python/apache.py", line 28, in
> <module>
> ImportError: No module named _apache
>
> I guess this looks good (as I've seen it in some mail archives).
>
> But somehow the PYTHONPATH is not used while mod_python initialization?!
>
> Any help would be appreciated. :)
>
> -soenke
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>   
The simplest, and most evil, answer to this is after reboot  a different
version of python is being used that does not have the mod_python module
installed in its site-packages tree. From your helpful traceback, it
looks like the installed mod_python lib in Apache is still healthy and
being loaded properly.

Was this the same version as your were running pre-reboot? If so,
something serious happened to the entire mod_python module.

-- 
* Martin C. Stoufer              *
* DST/DIDC/ITG                   *
* Lawrence Berkeley National Lab *
* MS 50B-2239 510-486-8662       *

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3423 bytes
Desc: S/MIME Cryptographic Signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20061220/fc9ccb24/smime.bin


More information about the Mod_python mailing list