[mod_python] FW: Mod_Python

Jim Gallacher jpg at jgassociates.ca
Thu Jul 26 09:29:49 EDT 2007

Jed Drury -X (jedrury - Manpower at Cisco) wrote:
> Hi Jim,
> Thanks for getting back to me so promptly.  The problem is that when I try
> to test mptest.py there is no identification of mod apache. 

But you are calling mptest.py from your browser, right?

ie http://localhost/test/mptest.py

(Substituting the correct host for localhost, and assuming that 
mptest.py resides in the htdocs/test directory.)

The error log you posted previously indicates that mod_python is getting 

Perhaps you could post the contents of your mptest.py file?


PS. I'm heading out the door shortly and won't be back until later this 

> I know that I'm
> close to solving this problem.  However, there is something that I'm
> missing.  
> Jed Drury 
> -----Original Message-----
> From: Jim Gallacher [mailto:jpg at jgassociates.ca] 
> Sent: Thursday, July 26, 2007 9:05 AM
> To: jedrury at cisco.com
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] FW: Mod_Python
> Jed
> 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
> </Directory>
> 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.
> Jim
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list