Graham Dumpleton
grahamd at dscpl.com.au
Tue Mar 22 16:13:34 EST 2005
How many versions of Python are installed on your system? You appear to be trying to use the one in /usr/local, is that the one you actually want? When you configured Apache, did you tell it to use a particular version or simply use whatever it could find? Have you got PYTHONPATH set manually in your environment or that of Apache? Anyway, this particular sort of problem is generally the result of issues with there being multiple versions of Python on a system, or a missing or incomplete install of the Python side of the mod_python system. Go through each of the site-packages directories for each version of Python you have and see which have a mod_python directory, when the files were copied into the directory and try and work out which version of mod_python the files may be for. If a mod_python installation is 3.X, it will have psp.py in the Python mod_python package directory. Doing this may help clarify for you what went where and what version Apache might be trying to load. I wander whether the mod_python module when it is being loaded from Apache should dump out to the Apache error log the contents of sys.path. This may aid in debugging these sort of problems as right now it isn't easily detectable where Apache may be looking. The startup message may say which version of Python the Apache module was compiled against, but this is not necessarily a true indication of where it is looking for modules. BTW, also read: http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.001.htp Also tell us what operating system you are using. Graham On 23/03/2005, at 1:05 AM, Dave Britton wrote: > When I am logged in under su as root I can start python and import > mod_python. (import * fails of course on _apache): > ======== > [Tue Mar 22 14:00:38 2005] [info] Server built: Mar 16 2005 19:13:58 > [Tue Mar 22 14:00:38 2005] [debug] prefork.c(956): AcceptMutex: > sysvsem (default: sysvsem) > [Tue Mar 22 14:01:52 2005] [error] make_obcallback: could not import > mod_python.apache.\n > [root at ap1 apache2]# python > Python 2.3.3 (#1, May 18 2004, 02:14:01) > [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import mod_python >>>> from mod_python import * > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/usr/local/lib/python2.3/site-packages/mod_python/apache.py", > line 28, in ? > import _apache > ImportError: No module named _apache > ========== > I have tried many different configurations for mod_python and none of > them have worked so far. The one I currently have which fails is the > very simple: > <Directory /usr/local/apache2/htdocs> > AddHandler mod_python .py > PythonHandler mptest > PythonDebug On > </Directory> > > Is there some special flag for mod_python's configure? > Thanks for helping! > -Dave > > ----- Original Message ----- From: "Nicolas Lehuen" > <nicolas.lehuen at gmail.com> > To: "Dave Britton" <dave at davebritton.com> > Cc: <mod_python at modpython.org> > Sent: Tuesday, March 22, 2005 8:23 AM > Subject: Re: [mod_python] apache2 won't load mod_python > > >> Hi, >> >> mod_python is loaded all right, but it cannot find the mod_python >> module. If you login under the same account Apache is running under, >> can you also import mod_python ? Could you give us your httpd.conf >> lines related to the mod_python configuration ? >> >> Regards, >> Nicolas >> >> >> On Tue, 22 Mar 2005 08:05:49 -0500, Dave Britton >> <dave at davebritton.com> wrote: >>> I have built apache 2.053 and mod_python 3.1.4 and apache serves >>> pages ok, >>> and python will import mod_python, so both exist in the right >>> places, but I >>> get this error message, on attempting to access the simple mptest.py >>> example: >>> ======== >>> [Tue Mar 22 13:38:42 2005] [notice] SIGHUP received. Attempting to >>> restart >>> [Tue Mar 22 13:38:42 2005] [notice] mod_python: Creating 25 session >>> mutexes >>> based on 25 max processes and 0 max threads. >>> [Tue Mar 22 13:38:42 2005] [notice] Apache/2.0.53 (Unix) >>> mod_python/3.1.4 >>> Python/2.3.3 configured -- resuming normal operations >>> [Tue Mar 22 13:38:42 2005] [info] Server built: Mar 16 2005 19:13:58 >>> [Tue Mar 22 13:38:42 2005] [debug] prefork.c(956): AcceptMutex: >>> sysvsem >>> (default: sysvsem) >>> [Tue Mar 22 13:39:17 2005] [error] make_obcallback: could not import >>> mod_python.apache.\n >>> [root at ap1 apache2]# >>> ======== >>> apache was built with the configure --enable-so option, to allow DSO >>> imports. >>> >>> I've been struggling with this for a couple of days, and I am >>> clueless. I'd >>> appreciate any help! >>> Thanks! >>> -Dave >>> >>> _______________________________________________ >>> Mod_python mailing list >>> Mod_python at modpython.org >>> http://mailman.modpython.org/mailman/listinfo/mod_python >>> > > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|