mod python question

Markus Jais info at mjais.de
Tue Nov 26 17:44:06 EST 2002


hello
I have the example from the mod python tutorial

from mod_python import apache

def handler(req):
    req.content_type = "text/html"
    req.send_http_header()
    req.write("Eagles are great")
    return apache.OK

and this setup

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


this works fine.

but when I change the <Directory> directive to
----
<Location /python> 
  AddHandler python-program .py
  PythonHandler mptest 
  PythonDebug On 
</Location>
---
I get this error in my apache logfile:
[Tue Nov 26 00:07:18 2002] [notice] mod_python: (Re)importing mptest from 
None
[Tue Nov 26 00:07:18 2002] [error] PythonHandler mptest: Traceback (most 
recent call last):
[Tue Nov 26 00:07:18 2002] [error] PythonHandler mptest:   File 
"/usr/local/lib/python2.2/site-packages/mod_python/apache.py", line 181, in 
Dispatch
    module = import_module(module_name, _req)
[Tue Nov 26 00:07:18 2002] [error] PythonHandler mptest:   File 
"/usr/local/lib/python2.2/site-packages/mod_python/apache.py", line 332, in 
import_module
    f, p, d = imp.find_module(parts[i], path)
[Tue Nov 26 00:07:18 2002] [error] PythonHandler mptest: ImportError: No 
module named mptest


I am using python 2.2.2, modpython 2.7.8 and apache 1.3.23 (rpm version for 
redhat 7.3)

markus





More information about the Python-list mailing list