[mod_python] FW: Mod_Python

Jim Gallacher jpg at jgassociates.ca
Thu Jul 26 09:05:07 EDT 2007


According to your httpd error.log, mod_python is loading properly.

Jed Drury -X (jedrury - Manpower at Cisco) wrote:
> -----Original Message-----
> From: jed drury [mailto:jeddrury at yahoo.com] 
> Sent: Thursday, July 26, 2007 5:14 AM
> To: jedrury at cisco.com
> Subject: Mod_Python
> Hello Graham,
> Thanks for your assistance.  The absolute path to where my mod_python is
> installed is c:\Python25 or C:\Apache Group\Apache2.2\modules.  From what
> I've seen, it is installed on my system.  My main problems are just
> configuring the httpd.conf file so that I don't always get the  
> "Traceback (most recent call last):
>   File "C:\Python25\mptest.py", line 1, in <module>
>     from mod_python import apache
>   File
> "C:\Python25\Lib\site-packages\mod_python\apache.py",
> line 30, in <module>
>     import _apache
> ImportError: No module named _apache"

I'll bet this is from a command line interpreter, right? You can't run 
mod_python from the command line, only from within the apache httpd server.

> errors every time I try to run the mptest.py.
> I even tried to create the .htaccess file with "AddHandler python-program
> .py PythonHandler mptest PythonDebug On" but to no avail. 

Is .htaccess even being read? Make sure you have something like the 
following in your httpd.conf:

<Directory /some/directory/htdocs/test>
    AllowOverride FileInfo

You could also stick:

AddHandler mod_python .py
PythonHandler mptest
PythonDebug On

in there as well, but while you're experimenting it's likely easier to 
put these directives in your .htaccess file.


More information about the Mod_python mailing list