[mod_python] Re: python/mod_python.apache err msg

Graham Dumpleton grahamd at dscpl.com.au
Sat Mar 12 16:58:05 EST 2005


On 13/03/2005, at 4:30 AM, bruce wrote:

> when i do a 'import mod_python.apache', i get the following
>
> [root at lserver4 lib]# python
> Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
> [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import mod_python
>>>> import mod_python.apache
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 
> 28, in
> ?
>     import _apache
> ImportError: No module named _apache
>
> ...
>
> any ideas as to why i'm getting the 'ImportError: No module named 
> _apache'
> msg?

When doing an import of mod_python.apache from the command line Python,
this is exactly what you do want. The "_apache" module is a special
module which is embedded within the mod_python.so file which is loaded
into Apache. The "_apache" module will be preloaded into the Python
interpreter when Apache loads mod_python.so. Thus, it will only be there
when running scripts under mod_python proper under Apache.

The only reason I went down the track of asking you to try these imports
from command line Python in the first place, is because the errors which
will occur help to show which version of mod_python you have and whether
all the bits are there. You should now go back to trying the mptest case
under Apache itself and you may have more luck this time.


Graham



More information about the Mod_python mailing list