[mod_python] ImportError: No module named _apache

Huzaifa Tapal huzaifa at hostway.com
Mon Nov 1 10:43:18 EST 2004

David, I am running the latest version of Debian on my computer.  Also there
is no error when compiling the _apache module into mod_python and that is
what my original concern was that there seems to be no exception raised if
the compilation fails for _apache.

Here is what I am talking about:

_apacheModule.c: void init_apache(): line 533

Mp_ServerReturn = PyErr_NewException("_apache.SERVER_RETURN", NULL, NULL);
if (Mp_ServerReturn = NULL)

_apacheModule does not seem to be raising any exceptions when that occurs.

Brian, I just signed up with the list before I posted this message.  How can
I check all the previous list entries to find out how this problem was

As far as not running this through mod_python on the apache server, as far
as I am concerned, I am.  I pretty much followed exactly what is written in
the documentation including the test file they have to test mod_python, in
which the call to import apache fails:

from mod_python import apache

Any ideas guys?


-----Original Message-----
From: David Fraser [mailto:davidf at sjsoft.com] 
Sent: Friday, October 29, 2004 4:57 PM
To: Huzaifa Tapal
Cc: mod_python at modpython.org
Subject: Re: [mod_python] ImportError: No module named _apache

Huzaifa Tapal wrote:

> I have followed all the steps outlined in your documentation for 
> mod_python 3.1.3 for apache 2.0. however, when executing the test 
> script I am running into a problem where I get the following error:
> Traceback (most recent call last):
> File "mptest.py", line 1, in ?
> from mod_python import apache
> File 
> "/usr/local/python2.3.4/lib/python2.3/site-packages/mod_python/apache.py",

> line 28, in ?
> import _apache
> ImportError: No module named _apache
> After digging around a whole lot, I see that the _/apachemodule.c /is 
> getting compiled into the mod_python.so binary. I checked the 
> init_apache() method in _apachmodule.c and at one point if there is an 
> error compiling the _apache module into mod_python, it errors out 
> silently without any exceptions being raised.
> I am afraid that the _apache module might be erroring out and as a 
> result mod_python is not functioning.
> Can you please shed some light?
It would be great if you could say what platform you are using, and what 
the error compiling the _apache module into mod_python is ...


More information about the Mod_python mailing list