[mod_python] In ubuntu 6.06! make_obcallback(): could not import mod_python.apache

yeqiwei yeqiwei001 at gmail.com
Tue Aug 8 03:24:30 EDT 2006

My os is Ubuntu 6.06.
Apache is 1.3.34
mod_python is 2.7.10
python 2.4.1a0
I install these software using the apt-get install command.

apache documentroot is /var/www. And I make a dir test.

in http.conf, I write this:
<Directory /var/www/test>
		AddHandler python-program  .py
		PythonHandler mptest
        PYtohnDebug On

and in the modules.conf 
LoadModule  python_module /usr/lib/apache/1.3/mod_python

in /var/www/test, I put a mptest.py file the content is
from mod_python import apache

def handler(req):
    req.write("Hello World!")
    return apache.OK

when I point to http://127.0.0.l/test/mptest.py,  get the 500 Internal Server Error
And I check the apache error.log,fount that

make_obcallback():could not import mod_python.apache
make_obcallback():could not call init
........python_handler: make_obcallback returned no obCallBack!

I have install python2.3 and python 2.4,but the /usr/bin/python is linked to 
the /usr/bin/python2.4.
And I run mptest.py in shell, the error information is that:

Traceback (most recent call last)
 File "/var/www/test/mptest.py",line 1, in ?
   from mod_python import apache
 File "/usr/lib/python2.4/site-packages/mod_python/apache.py",line 55 in ?
   import _apache
ImportError: No module named _apache

How can I solve this problem? 

More information about the Mod_python mailing list