[mod_python] Mac OS X Leopard upset my mod_python test bed.

Simon Kesenci god at skri.org
Sun Nov 25 15:32:33 EST 2007

I recently upgraded my PowerBook (PPC) to Leopard.  Piece by piece I  
started reassembling my web server test bed (httpd 2.2.6, Python  
2.5.1, mod_python 3.3.1), which worked perfectly on Tiger.  I built  
everything from their sources.

This time around I got everything to work except for mod_python.  My  
procedure had the following non-standard edits:

httpd 2.2.6:
     Changed APR_HAS_SENDFILE to 0 in srclib/apr/include/apr.h
     After installation I backed up /usr/sbin/httpd and entered
       ln -s /usr/local/apache2/bin/httpd /usr/sbin/httpd.
     (This allows you to activate the compiled httpd from the Sharing  
Preferences, which will also have the built-in firewall open and close  
port 80 in sync with the server.)

Python 2.5.1:
     After ./configure --enable-framework I added -DSETPGRP_HAVE_ARG  
to the top-level Makefile (make exits with an error otherwise due to a  
lack of arguments to setpgrp()).

Both of the above work as expected, but when I threw mod_python into  
the mix I kept getting the following error:

[Sun Nov 25 09:43:22 2007] [error] make_obcallback: could not import  
ImportError: No module named mod_python.apache
[Sun Nov 25 09:43:22 2007] [error] make_obcallback: Python path being  
used "['/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/ 
python2.5/plat-darwin', '/usr/lib/python2.5/plat-mac', '/usr/lib/ 
python2.5/plat-mac/lib-scriptpackages', '/usr/lib/python2.5/lib-tk', '/ 
usr/lib/python2.5/lib-dynload', '/Library/Python/2.5/site-packages']".
[Sun Nov 25 09:43:22 2007] [error] get_interpreter: no interpreter  
callback found.
[Sun Nov 25 09:43:22 2007] [error] [client] python_handler:  
Can't get/create interpreter., referer:

I used a number of scripts to test the installation, including  
mptest.py from the mod_python doc.  The last script I used to test did  
not import mod_python.apache explicitly:

from mod_python import util

def index(req):
   util.redirect(req, 'www.example.com')

While installing mod_python the output made clear that it took up the  
interpreter in /usr/local/bin rather than the one provided by Apple  
in /usr/bin and installed under /Library/Frameworks/Python.framework/ 
Versions/2.5/lib/python2.5/site-packages/ rather than /Library/Python/ 

I don't know from where it pulled that path.  The interpreter I  
compiled uses the path:

['', '/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python25.zip', '/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5', '/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/plat-darwin', '/Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5/plat-mac', '/Library/Frameworks/Python.framework/ 
Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages', '/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/ 
dynload', '/Library/Frameworks/Python.framework/Versions/2.5/lib/ 

The interpreter provided by Apple uses:

['', '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python25.zip', '/System/Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5', '/System/Library/Frameworks/Python.framework/ 
Versions/2.5/lib/python2.5/plat-darwin', '/System/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/plat-mac', '/System/ 
mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/ 
Versions/2.5/Extras/lib/python', '/System/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/lib-tk', '/System/Library/ 
Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', '/ 
Library/Python/2.5/site-packages', '/System/Library/Frameworks/ 

This morning I logged on to my Linux web server and installed all  
these packages from source without any problems.


More information about the Mod_python mailing list