[mod_python] mod_python configuration problem?

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


Hi, 

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 
message: 

   "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 
mod_python-3.0.3-3.ent
(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 
Gnu/Linux

I put the following mptest.py:

   from mod_python import apache

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

with .htaccess:

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

and pointed to URL:  
https://bugzi.llnl.gov/cgi-bin/tracker/modtest/mptest.py

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

from mod_python import apache
File 
"/usr/src/build/345626-i386/install/usr/lib/lib/python2.2/site-packages/mod
_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.
Thanks,
Lila

-- 
Lila Chase
lchase at llnl.gov



More information about the Mod_python mailing list