[mod_python] python/mod_python.apache err msg

bruce bedouglas at earthlink.net
Sat Mar 12 12:30:43 EST 2005

graham.. sorry about the time dealy since the last post!

ok.. i now have a fresh/newly installed FC3 linux. i have the following
[root at lserver4 lib]# rpm -q httpd
[root at lserver4 lib]# rpm -q mod_python
[root at lserver4 lib]# rpm -q python

when i do a 'import mod_python, i get no return errs.

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
>>> import sys
>>> print sys.prefix

my dirs/locations for mod_python/mod_python.so are:

[root at lserver4 lib]# ls /usr/lib/python2.3/site-packages/mod_python
apache.py ....

[root at lserver4 lib]# ls /etc/httpd/modules
mod_python.so ...

as far as i can tell, the dirs are similar to an FC2 system i have that
appears to have mod_python/apache installed correctly.

any ideas as to why i'm getting the 'ImportError: No module named _apache'



-----Original Message-----
From: Graham Dumpleton [mailto:grahamd at dscpl.com.au]
Sent: Saturday, March 05, 2005 4:43 PM
To: bedouglas at earthlink.net
Cc: mod_python user mailing list
Subject: Re: python/linux guru needed.. now!!!!

On 06/03/2005, at 9:10 AM, bruce wrote:

> graham...
> i did post this issue/question to the modpython group... although i
> haven't
> posted there for a guru...

And on the mod_python mailing list you were asked some questions and
given some things to try. You didn't however give an answer to the
questions. We can't read minds. :-)

> but in answer to the rest of your questions....
> here's what i'm doing...
> python
> pyhton 2.3.3 ......
> type help...
>>>> import mod_python.psp
>   .
>   .
>   .
> ImportError: No module named mod_python

Getting this error in itself is strange, as trying to import a submodule
of a module that does not exist, would usually yield:

   ImportError: No module named mod_python.psp

if the parent module does not exist.

Either way, it simply doesn't look like mod_python is installed for that
version of Python. Does saying:

   import mod_python

fail as well. What error does it give in that situation?

You can verify manually whether it has been installed by finding the
directory for the Python installation and looking in there for a

Note that there are two parts to the installation of mod_python, there
is the
Apache handler .so which gets installed in Apache modules directory and
Python code modules which get installed in "site-packages". So far it
it is the latter that does not exist.

Anyway, if you don't know where to look for the "site-packages"
directory, run
in Python:

   import sys
   print sys.prefix

This should tell you where Python stuff is being installed. For Python
2.3, the
site-packages directory would be in a subdirectory of that directory


Thus change to directory specified by sys.prefix and then run:

   ls lib/python2.3/site-packages/mod_python

Does that say the directory doesn't exist? If it doesn't exist, then
your installation
isn't complete. If it does exist, what is in that directory?

I also ask again the same question as posed in the original mailing
list response to
you, do you possibly have more than one version of Python installed on
your system?

> i'm doing the above from the linux command line
> i have
> RH8.0
> python-2.3.3-6
> mod_python-3.1.3-5
> apache/2.0.50 (built from source)
> so, any ideas!!!
> thanks...
> bruce
> -----Original Message-----
> From: python-list-bounces+bedouglas=earthlink.net at python.org
> [mailto:python-list-bounces+bedouglas=earthlink.net at python.org]On
> Behalf
> Of grahamd at dscpl.com.au
> Sent: Saturday, March 05, 2005 1:56 PM
> To: python-list at python.org
> Subject: Re: python/linux guru needed.. now!!!!
> bruce wrote:
>> hi...
>> i have a situation with a linux rh8 server. i can't seem to get
>> python/mod_python/apache working as one...
>> i can't seem to import mod_python from the python interpreter to
> work, and
>> i'm not sure as to why. i'm fairly convinced that it's a conflict
> issue of
>> some type, but i'm not sure as to how to resolve it...
>> if you are a guru with python/mod_python/linux then i'd like to talk
> with
>> you...
>> searching through google/mailing lists/etc... is getting me nowhere!!
> You will do better if you present your problem in the mod_python
> mailing
> list. Go to http://www.modpython.org to get the mailing list details,
> get
> yourself on the list and then post the following information as a
> start.
> Which version of mod_python you are using.
> Whether you are using the global configuration file or a .htaccess
> file.
> The snippet of the Apache configuration you are using to configure
> mod_python and enable its use in the directory you are working in.
> Details of any error responses which are being displayed by your web
> browser.
> Details of messages, be they notices or error messages, which occur in
> the Apache error log file corresponding to any request you are making
> which is not working.
> The full contents of the Python code file for the content handler you
> are
> trying to use.
> --
> http://mail.python.org/mailman/listinfo/python-list

More information about the Mod_python mailing list