[mod_python] Re: \\[mod_python\\] In ubuntu 6\\.06\\! make_obcallback\\(\\): could not import mod_python\\.apache

Rob Sanderson azaroth at liverpool.ac.uk
Wed Aug 9 08:40:33 EDT 2006


Check that the path for whichever user (probably root) starts up the web
server has the right environment set.

For example, if I compile apache, python and mod_python as UserA and
install to a local directory, then start the web server as root (in
order to bind port 80), it uses the wrong python (system, not newly
installed).

If I instead write a script to export PATH, LD_LIBRARY_PATH and
LD_RUN_PATH before calling httpd, then it uses the right installation.
Setting the variables in envvars and envvars-std isn't sufficient (in my
experience)

Rob

On Wed, 2006-08-09 at 21:33 +1000, Graham Dumpleton wrote:
> Please use reply-all so responses go back to the mailing list.
> 
> On 09/08/2006, at 9:19 PM, yeqiwei wrote:
> 
> > I can't understand.
> > In my ubuntu ,I install  python2.4 & python2.4-dev. Does this cause  
> > such error?
> 
> Shouldn't, you need to have both. What I was thinking what that the
> python2.4-dev didn't correspond to the exact same version of Python
> that main python2.4 package was. Ie., python2.4 was Python 2.4.3
> and python2.4-dev was 2.4.1a0. If you updated both at the same time
> though, this should be unlikely though.
> 
> At this point, not sure what is really going on. If you got it working
> with Python 2.3 versions of packages then just go with that.
> 
> Graham
> 
> > #dpkg -L python2.4-dev,
> > I can't find any python file in /usr/bin or else dir in $PATH
> >
> >> Looks like your Python 2.4 installation has been stuffed up, or  
> >> you have
> >> Python 2.4.1a0 installed somewhere else on your box as well and that
> >> is what is being found. One possibility is that Python 2.4 package is
> >> split
> >> into main and dev and you have main from Python 2.4.3 but dev from  
> >> the
> >> older Python 2.4.1a0 and that is stuffing things up.
> >>
> >> Graham
> >>
> >> On 09/08/2006, at 8:36 PM, yeqiwei wrote:
> >>
> >>> Thanks!
> >>> In my os,the /usr/bin/python is linking to /usr/bin/python2.4.
> >>>
> >>> I solved this problem by replacing libapache-mod-python2.4 with
> >>> libapache-mod-python2.3,
> >>> And using python2.3 instead of python2.4
> >>>
> >>> the python2.4 version in ubuntu is python 2.4.3,
> >>> in apache log, I find that "mod_python/2.7.10 Python/2.4.1a0"
> >>> does this matter? 2.4.1a0 or  2.4.3
> >>>
> >>>> These problems are always hard to debug when using mod_python  
> >>>> 2.7.X.
> >>>> Some extra debug was added in mod_python 3.2.10 to make it  
> >>>> easier to
> >>>> work out, but that requires Apache 2.0/2.2 and you can't use
> >>>> Apache 1.3.
> >>>>
> >>>> Anyway, all I can think of is that the user that Apache runs as is
> >>>> finding a
> >>>> different version of the python executable on its PATH or it is
> >>>> getting confused
> >>>> by you having multiple versions installed. Do you have any other
> >>>> versions
> >>>> of Python installed, such as in /usr/local/bin, even perhaps a
> >>>> symlink there
> >>>> pointing to python2.3.
> >>>>
> >>>> Any chance of upgrading to Apache 2.2 and mod_python 3.2.10?
> >>>>
> >>>> Graham
> >>>>
> >>>> On 08/08/2006, at 5:24 PM, yeqiwei wrote:
> >>>>
> >>>>> My os is Ubuntu 6.06.
> >>>>> Apache is 1.3.34
> >>>>> mod_python is 2.7.10
> >>>>> python 2.4.1a0
> >>>>> I install these software using the apt-get install command.
> >>>>>
> >>>>> apache documentroot is /var/www. And I make a dir test.
> >>>>>
> >>>>> in http.conf, I write this:
> >>>>> <Directory /var/www/test>
> >>>>> 		AddHandler python-program  .py
> >>>>> 		PythonHandler mptest
> >>>>>         PYtohnDebug On
> >>>>> </Directory>
> >>>>>
> >>>>> and in the modules.conf
> >>>>> LoadModule  python_module /usr/lib/apache/1.3/mod_python
> >>>>>
> >>>>> in /var/www/test, I put a mptest.py file the content is
> >>>>> from mod_python import apache
> >>>>>
> >>>>> def handler(req):
> >>>>>     req.send_http_header()
> >>>>>     req.write("Hello World!")
> >>>>>     return apache.OK
> >>>>>
> >>>>> when I point to http://127.0.0.l/test/mptest.py,  get the 500
> >>>>> Internal Server Error
> >>>>> And I check the apache error.log,fount that
> >>>>>
> >>>>> make_obcallback():could not import mod_python.apache
> >>>>> make_obcallback():could not call init
> >>>>> ........python_handler: make_obcallback returned no obCallBack!
> >>>>>
> >>>>>
> >>>>> I have install python2.3 and python 2.4,but the /usr/bin/python is
> >>>>> linked to
> >>>>> the /usr/bin/python2.4.
> >>>>> And I run mptest.py in shell, the error information is that:
> >>>>>
> >>>>> Traceback (most recent call last)
> >>>>>  File "/var/www/test/mptest.py",line 1, in ?
> >>>>>    from mod_python import apache
> >>>>>  File "/usr/lib/python2.4/site-packages/mod_python/apache.py",line
> >>>>> 55 in ?
> >>>>>    import _apache
> >>>>> ImportError: No module named _apache
> >>>>>
> >>>>>
> >>>>> How can I solve this problem?
> >>>>>
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> 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
-- 
Dr Robert Sanderson
Dept of Computer Science, University of Liverpool
Home:     http://www.csc.liv.ac.uk/~azaroth/
Cheshire: http://www.cheshire3.org/



More information about the Mod_python mailing list