[mod_python] Apache 1.3.12, Python 1.6, mod_python 2.5 not playing well together

Ben Leslie benno at sesgroup.net
Thu Sep 28 10:51:18 EST 2000


Hi Jeff!

On Wed, 27 Sep 2000, Jeff Okamoto wrote:

> Hello,
> 
> I've got Apache 1.3.12, Python 1.6, and mod_python 2.5.  I can compile
> mod_python just fine, and have configured Apache and created an mptest.py
> as the Installation documentation says.  However, when I try to access
> it, I get the following error:
> 
> Mod_python error: "PythonHandler mptest"
> 
> Traceback (most recent call last):
> 
>   File "/usr/local/lib/python1.6/site-packages/mod_python/apache.py", line 135,
>     in Dispatch module = import_module(module_name, req)
> 
>   File "/usr/local/lib/python1.6/site-packages/mod_python/apache.py", line 276,
>     in import_module module = __import__(module_name)
> 
> ImportError: No module named mptest
> 
> I've checked the ML archives, and saw a message by Jeremy Hylton that was
> almost exactly the problem I've encountered, but he was using mod_python
> 2.0, not 2.5.
> 
> Can someone give me some additional suggestions of what to try next?


I ran into this same problem, it means that mptest is not in the path correctly.

My httpd.conf has this in it:



<Directory /var/www>
AddHandler python-program .py
PythonHandler mptest
PythonDebug on
</Directory>


The trick is that whatever is specified as the directory will get added to the
sys.path when trying to find the module.

If your apache root is somewhere else like (/home/www or something) then add that
instead.


Cheers,

Ben


(oh and as my first post to the list I will add my congrats and thanks to the 
author for such a great program!)



More information about the Mod_python mailing list