[mod_python] Problems with mod_python

Peter Halliday peter at wl.vg
Sun Jul 16 23:37:25 EST 2000

While waiting for someone to email me an RPM of mod_python 2.4.1, I
tried compiling it.  I got a copy of the apache source as well as the
above mod_python source.  Then I installed it using the DSO instructions
on the modpython webpage.  Everything seemed to go ok.  (One problem
however, I was unsure whether my python was compiled using thread
support because I use RedHat with the standard RPM that came with it. 
However, everything seemed ok when I compiled.  No error messages.  I
added these lines to my apache config file.

LoadModule python_module  module/mod_python.so
AddModule mod_python.c
AddHandler python-program .py
PythonHandler test
PythonDebug On
I changed the FileInfo directive to AllowOverride in the apache conf
and then in my mime.types file I added:
application/x-python py

In my DocumentRoot directory I created a directory called test.  I had a
script with the following contents.

from mod_python import apache

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

I still get the same error when I add a '#!/usr/bin/python' to the top
of the file.  The following is the error that I receive.  I am running
RedHat Linux 6.2, Apache 1.3.12, mod_python 2.4.1., python 1.5.  I have
kept everything standard as came on RedHat.  

Mod_python error: "PythonHandler test"

Traceback (innermost last):

  File "/usr/lib/python1.5/site-packages/mod_python/apache.py", line
116, in Dispatch
    object = self.resolve_object(module, object_str)

  File "/usr/lib/python1.5/site-packages/mod_python/apache.py", line 51,
in resolve_object
    raise AttributeError, s

AttributeError: module '/usr/lib/python1.5/test/__init__.pyc' contains
no 'handler'

Peter Halliday
Online Application Developer
Whetstone Logic, Inc.       http://www.whetstonelogic.com
icq#75769411           AIM screen name: hoaggelos

More information about the Mod_python mailing list