[mod_python] ImportError: No module named mptest

Jochen Preusche jp at jochenpreusche.de
Tue Nov 6 14:26:26 EST 2007

Hi folks,

I just started with and mod_python. I get stuck with the Error message
below. Any help would be appreciated.

I'm using Ubuntu 7.04, Lampp, Apache/2.2.4 (Unix), mod_python/3.3.1 and

I followed the instructions to this point

testing with the script describet at the tutorial. Unregarded the
scripts content it reports this one:


ProcessId:      14842
Interpreter:    'localhost'

ServerName:     'localhost'
DocumentRoot:   '/opt/lampp/htdocs'

URI:            '/test/mptest.py'
Location:       None
Directory:      '/opt/lampp/htdocs/'
Filename:       '/opt/lampp/htdocs/test/mptest.py'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'mptest'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1202, in _process_target
    module = import_module(module_name, path=path)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
304, in import_module
    return __import__(module_name, {}, {}, ['*'])

ImportError: No module named mptest

Here is what I've put in the httpd.config file:

LoadModule python_module /opt/lampp/modules/mod_python.so

<Directory /opt/lampp/htdocs>
	AddHandler mod_python .py
	PythonHandler mptest
	PythonDebug On

<Location /mpinfo>
      SetHandler mod_python
      PythonHandler mod_python.testhandler

I guess there must be any file named mptest but I can't find it ...

Thank you for your time

More information about the Mod_python mailing list