mod_python seems to be missing a file

MM mmichalski3 at
Tue Oct 16 20:13:47 CEST 2001

Here is the apache error generated when I try to view a file named

Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

  File "C:\PYTHON21\lib\mod_python\", line 181, in Dispatch
    module = import_module(module_name, _req)

  File "C:\PYTHON21\lib\mod_python\", line 335, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named mptest

Here is the configuration directive in the httpd.conf file:
<Directory /pytest>
    AddHandler python-program .py
    PythonHandler mptest
    PythonDebug On

I'm not sure what you mean by Python runtime and when the file's loaded.
I've placed the mod_python.dll in the modules directory of Apache and added
the appropriate LoadModule directive into the configuration file.  When
Apache loads it tells me "Apache 1.3.20 (Win32) mod_python/2.7.4
Python/2.1.1 running..."

That's the only configuration I've done with respect to Apache and Python.
Please let me know if I'm missing something.

Jan Dries <jdries at> wrote in message
news:mailman.1003176151.32729.python-list at
> MM wrote:
>  > I've followed the mod_python documentation to the letter.  It seems
> to be on
>  > the verge of working with the one following problem:
>  >
>  > from mod_python import apache
>  >
>  > this is the first line of the test program you're told to write to see
>  > you're up and running.  The problem with this is that the
> file in
>  > the mod_python package is trying to import a file called _apache.  I
> cannot
>  > find this file anywhere and, apparently, neither can Python, since it
>  > complains about it, as well.  Any help on where this file can be
> found would
>  > be appreciated.
>  >
> If you check the C source, you will find that the mod_python DLL itself
> export a function init_apache().
> In other words, mod_python.dll is your missing _apache.pyd. When
> mod_python.dll is loaded, the function is registered to the Python
> runtime, and from that moment on the module _apache is known to the
> Python interpreter.
> If you could tell what exactly the errors are that you get in trying to
> make mod_python work, maybe I could tell what's going wrong. But it
> certainly isn't the fact that some would be missing.
> Regards,
> Jan

More information about the Python-list mailing list