[mod_python] mod_python configuration problem?

chase3 at llnl.gov chase at oldben.llnl.gov
Fri Dec 2 12:58:03 EST 2005


I am trying new to mod-python and have only light knowledge of
CGI scripting.  A CGI script written by someone else is too slow, 
and I want to try converting it to mod_python.  

Looking at Graham's "Getting mod_python Working" doc, I think 
mod_python is installed at version 2.7 because I get the 

   "ImportError: No module named psp."  

The sys admin told me that mod_python is built into apache, so no need to 
load it.  Our local Apache server is at 2.0.46.  Earlier he gave me 
this version info on Python products: python 2.2.35 and 
(We are only approved to run enterprise 3.x and apache 2.x.)
uname -a shows: Linux ... 2.4.21-20.ELsmp #1 SMP ... i686 i686 i386 

I put the following mptest.py:

   from mod_python import apache

   def handler ( req ):
      req.content_type = "text/plain"
      req.write ( "Hello modtest" )
      return apache.OK

with .htaccess:

   <Directory /usr/web/cgi-bin/tracker/modtest>
   AddHandler mod_python .py
   PythonHandler mptest 
   PythonDebug On

and pointed to URL:  

I got an Internal server error and found out that it was due to an 
import error:

from mod_python import apache
_python/apache.py line 67 in ?
Import Error: No module named _apache

I also get a Premature end of script.

Another posting suggested that my problem is because mptest.py is being
run as a CGI script.  However, if I put the test in my home space, my 
browser is not able to get find it.

Any suggestions that would be helpful to getting the initial test to work
would be appreciated.

Lila Chase
lchase at llnl.gov

More information about the Mod_python mailing list