[mod_python] Newbie - problem running mptest.py

Karl Kobata karl.kobata at syncira.com
Wed Jun 21 01:22:46 EDT 2006

I was able to resolve the installation problem using many suggestions and
references by others.
For Redhat's RHEL3:
1) here are the stats from my server:
> cat /etc/redhat-release
Red Hat Enterprise Linux ES release 3 (Taroon Update 7)

> rpm -qa | grep httpd

> rpm -qa | grep mod_python
===NOTE: if this message does not show, either it means that mod_python is
not installed, or there is an installation error or it was installed using
"make install"

2) test if mod_python is being loaded or not.  Assumption is that there are
no error message in the log file or to the screen when restarting the apache
server (httpd).
> su root
> /sbin/service httpd stop
> httpd -X -e DEBUG
===NOTE: This command will list all modules being loaded and any error or
warnings.  Look to make sure one entry in the list that scrolls by is:
"[Tue Jun 20 18:58:53 2006] [debug] mod_so.c(290): loaded module

2a) use graham's test.  Launch python, and in interactive mode enter
import mod_python.psp
the return message will give you a good clue if mod_python is loaded and

3) once python executables have been resolved. Then do the following from
gnome or kde desktop:
> su root
> rpm -e mod_python
===NOTE: removes installed mod_python.
> up2date mod_python
===NOTE: this command will search RHN for the latest version of mod_python
for your server release.  It will also resolve dependencies required for
this application.  For me "mod_python 3.0.3-5.ent" was installed to work
with "Python 2.2.3 (#1, Feb  6 2006, 10:44:13)"

> cd /etc/httpd/conf.d

> vi python.conf
==NOTE: add the following.  I have had the most difficulty in this area.
Mostly because of my lack of understanding the details of the directives and
its syntax.  To start, cut and paste these into python.conf.  change the
path as reqired.  Must be absolute reference.
------------ cut& paste into python.conf ------------------
LoadModule python_module modules/mod_python.so

Alias /ModPython "/home/karl/projects/Mod_Python "

<Directory /home/karl/projects/Mod_Python>
  AllowOverride FileInfo
------------ end cut& paste into python.conf ------------------
===NOTE: alias makes url reference -> http://localhost/ModPython/mptest.py
===NOTE: the directory directive allows .htaccess to be read and executed in

> cd /home/karl/projects/Mod_Python

> vi .htaccess
===NOTE: cut and paste the following
------------ cut& paste into .htaccess ------------------
  AddHandler python-program .py
  PythonHandler mptest
  PythonDebug On
------------ end cut& paste into .htaccess ------------------

> /sbin/service httpd restart

4) create mptest.py in "/home/karl/projects/Mod_Python" directory as in the
installation/test section of mod_python users manual or graham's writeup.

Please note, graham's write up at
http://www.dscpl.com.au/articles/modpython-001.html is very useful.  In
Redhats rhel3, the log file does not contain the message references.  This
may be due to either version of mod_python or apache server that is
available from redhat.  Otherwise very useful.

Hope this helps.  Please email if you have questions.

-----Original Message-----
From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of John Cartwright
Sent: Friday, June 16, 2006 2:40 PM
To: Karl Kobata
Cc: mod_python at modpython.org
Subject: Re: [mod_python] Newbie - problem running mptest.py

Hi Karl,

I'm having precisely the same problems in the same environment, but have
not found an answer. Please keep me posted if you sort it out and I'll
do likewise.

-- john

Karl Kobata wrote:
> ------------------------------------------------------------------------
> *From:* Karl Kobata [mailto:karl.kobata at syncira.com]
> *Sent:* Tuesday, February 28, 2006 3:00 PM
> *To:* 'mod_python at modpython.org'
> *Subject:* Newbie - problem running mptest.py
> I am new to mod_python.
> ------------------------------------------------------------------------

More information about the Mod_python mailing list