[mod_python] No module named _apache from inside apache

mod_python user python at theorb.net
Mon Sep 20 12:45:03 EDT 2004

John Raines wrote:
> Subject:
> [mod_python] No module named _apache from inside apache
> I continue to get this error message...
<snip />
> ImportError: No module named _apache

Hi John,

I have a solution, but I can't tell you exactly why it works, only that
it does.  There is probably a different and better way to do it.

I'm pretty new to python and by extension, mod_python, but I encountered
your situation once before. I was trying to use "_apache.parse_qs" and

The _apache module appears to be built-in to mod_python; furthermore, it
seems to be directly available *only* to other modules in the mod_python
directory.  So, in the mod_python directory I created a file,
"mp_helper.py", whose contents consist of only one line: "import
_apache".  Then, within my own application I include this line: "from
mod_python import mp_helper".

After that I was able to access parse_qs and parse_qsl as
mp_helper.parse_qs and mp_helper.parse_qsl.

Hope that is useful to you,
Mike Wright

More information about the Mod_python mailing list