[mod_python] mptest.py testing failed

Suhaimi Jamalludin suhaimi at niser.org.my
Tue Aug 10 13:49:19 EDT 2004


Hi All,

Really need your advice. I'm running FreeBSD5.2.1, apache 1.3.31, 
mod_python-2.7.10.
I got  this error in my httpd-error.log. FYI....apache is up an runing.

    make_obcallback(): could not import mod_python.apache.
    make_obcallback(): could not call init.
    [Tue Aug 10 11:57:32 2004] [error] [client 10.1.4.118] 
python_handler: make_obcallback returned no obCallBack!

Can somebody help me.

regards,
suhaimi

My step-by-step for mod_python on FreeBSD5.2.1
----------------------------------
1) Installed python
    # cd /usr/ports/lang/python
    # make -DWITHOUT_THREADS install clean

2) Installed mod_python
    # cd /usr/ports/www/mod_python
    # make -DWANT_EAPI install clean

3) Modify apache configuration file
    #vi /usr/local/etc/apache/http.conf
    add below line at the end of the http.conf
    ----snip-----
    <Directory /usr/local/www/cgi-bin/modpython>
      AddHandler python-program .py
      PythonHandler mptest
      PythonDebug On
    </Directory>
    ----snap-----

4) Create mptest.py
    # vi /usr/local/www/cgi-bin/modpython/mptest.py
    add below line in mptest.py
    ----snip-----
    from mod_python import apache

    def handler(req):
            req.write("Hello World!")
            return apache.OK
    ----snap-----
   
5) Restart Apache
    # /usr/local/etc/rc.d/apache restart
   
6) Open Mozilla Web Browser type the mod_python test file as below.

    http://10.1.4.8/cgi-bin/modpython/mptest.py

    Browser output:
   
    Internal Server Error
    The server encountered an internal error or misconfiguration and was 
unable to complete your request.
    Please contact the server administrator, root at local.domain and 
inform them of the time the error occurred, and anything you might have 
done that may have caused the error.
    More information about this error may be available in the server 
error log.

7) Check apache log file
    # tail /var/log/httpd-error.log
   
    [Tue Aug 10 11:57:24 2004] [notice] caught SIGTERM, shutting down
    [Tue Aug 10 11:57:28 2004] [notice] Apache configured -- resuming 
normal operations
    [Tue Aug 10 11:57:28 2004] [notice] Accept mutex: flock (Default: flock)
    'import site' failed; use -v for traceback
    make_obcallback(): could not import mod_python.apache.
    make_obcallback(): could not call init.
    [Tue Aug 10 11:57:32 2004] [error] [client 10.1.4.118] 
python_handler: make_obcallback returned no obCallBack!


More information about the Mod_python mailing list