2006年01月21日 星期六 15:22
我的系统是ArchLinux(我发现Arch的maillist上也有类似的问题,但是没有什么解决方案)。 Apache 2.0.54或者Apache2.0.55 Modpython 3.2和3.1 Python 2.4 Quixote最新版 成功安装mod_python,windows 2003下的能正常运行demo,linux下的引发apache 500错误,查看错误记录: make_obcallback: could not import mod_python.apache.\n 1) 从python直接import mod_python, windows 和 linux环境都成功 2) 从python直接import mod_python.apache, windows 和 linux环境都发生错误: No module named _apache 3) 查看site-package目录下面的mod_python/apache.py文件,发现里面都要import _apache这个模块 到mod_python的maillist去,发现人家说要设置PYTHONHOME环境变量,指向web程序目录,而不是默认的python目录(不知道我英文是不是有问题,但是我的ie崩溃,我找不回那个帖子了,等下我试着找一个比较接近的结果帖上来)。 4) 我在刚才说的apache.py文件里面加了点东西,查看load module _apache是否成功。 即把apache.py的import部分改成如下所示: mylog = open("F:\\mod_python.tmp.log.txt","w") mylog.write("importing mod_python.apache\n") import sys import traceback import time import os import pdb import stat import imp import types import _apache mylog.write("imported _apache\n") mylog.close() 在linux下也这样改了。 windows 2003 的结果: importing mod_python.apache imported _apache linux的结果: importing mod_python.apache 说明,确实没有import这个模块,我想问的是,配置了mod_python的同志,有没有设置PYTHONHOME的经验,或者是否知道这个问题的解决方法。 感激不尽! -- Yours, fluke fluke at sfcube.net http://blog.ospattern.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060120/50a46e0e/attachment.htm
2006年01月21日 星期六 19:26
On 1/20/06, Fluke <fluke.l at gmail.com> wrote: > > 我的系统是ArchLinux(我发现Arch的maillist上也有类似的问题,但是没有什么解决方案)。 > Apache 2.0.54或者Apache2.0.55 > Modpython 3.2和3.1 > Python 2.4 > Quixote最新版 > > 成功安装mod_python,windows 2003下的能正常运行demo,linux下的引发apache 500错误,查看错误记录: > > make_obcallback: could not import mod_python.apache.\n > > 1) 从python直接import mod_python, windows 和 linux环境都成功 > > 2) 从python直接import mod_python.apache, windows 和 linux环境都发生错误: > No module named _apache > > 3) 查看site-package目录下面的mod_python/apache.py文件,发现里面都要import _apache这个模块 > > 到mod_python的maillist去,发现人家说要设置PYTHONHOME环境变量,指向web程序目录,而不是默认的python目录(不知道我英文是不是有问题,但是我的ie崩溃,我找不回那个帖子了,等下我试着找一个比较接近的结果帖上来)。 > > 看看这个manual 2.1. Python_handler: make_obcallback returned no obCallBack!At mod_python initialization time, mod_python imports some Python code that is in the mod_python package. In most cases this message means that Apache server has started mod_python and the Python interpreter successfully, but mod_python couldn't locate the mod_python package. Usually this is because it is not in the Python path, or because the uid under which Apache is running does not have correct permissions to those files. It may also be because the Python version compiled into mod_python doesn't match the version installed on your web server. Check to make sure that mod_python package is in your path. Usually it will be in /usr/local/lib/python2.1/site-packages, check the permissions on the files,check the uid under which Apache is running (in httpd.conf), and make sure Apache has at least read permission to those files. If you're still having trouble, try running this (strace may be substituted for truss or similar tool for your system): struss httpd -X 2>error_log This will list every directory Python searches when looking for mod_python in error_log file. If you are using a different python install for mod_python than the one you normally use, you have to make sure that the embedded python interpreter reads its libraries for the correct location. i.e. you may have instructed mod_python to use python in /home/httpd/python/, but mod_python will try to read its libraries from /usr/lib instead. To fix this, set the PYTHONHOME variable to point to your custom python version. export PYTHONHOME='/home/httpd/python' httpd -X 2>error_log If this solves your problem, then put PYTHONHOME='/home/httpd/python' in the script you use to start Apache, before the apache binary is started. ------ The specific error "make_obcallback returned no obCallBack!" is only generated in mod_python 2.7.X. In mod_python 3.X only a lower level error message is logged. These are of the form "make_obcallback: could not import ???" and "make_obcallback: could not call ???". All the same, the above advice is still pertinent. One should also take note of: http://www.modpython.org/FAQ/faqw.py?req=show&file;=faq02.003.htp This is because as well as logging the above messages, the underlying Python error message as to what caused a problem is recorded but via stderr. As detailed in this other FAQ entry, messages logged in stderr aren't necessarily visible in the log immediately and only appear when Apache is shutdown or restarted. Thus, if you get any errors related to make_obcallback, shutdown Apache and see if you find other error messages such as Python ImportErrrors etc. Edit this entry<file:///C:/Documents%20and%20Settings/Administrator/Desktop/faqw.py?req=edit&file;=faq02.001.htp>/ Log info<file:///C:/Documents%20and%20Settings/Administrator/Desktop/faqw.py?req=log&file;=faq02.001.htp>/ Last changed on Mon Mar 28 02:39:42 2005 by Graham Dumpleton <grahamd at dscpl.com.au> 4) 我在刚才说的apache.py文件里面加了点东西,查看load module _apache是否成功。 > 即把apache.py的import部分改成如下所示: > > mylog = open("F:\\mod_python.tmp.log.txt","w") > mylog.write("importing mod_python.apache\n") > > import sys > import traceback > import time > import os > import pdb > import stat > import imp > import types > import _apache > > mylog.write("imported _apache\n") > mylog.close() > 在linux下也这样改了。 > > windows 2003 的结果: > importing mod_python.apache > imported _apache > > linux的结果: > importing mod_python.apache > > > 说明,确实没有import这个模块,我想问的是,配置了mod_python的同志,有没有设置PYTHONHOME的经验,或者是否知道这个问题的解决方法。 > 感激不尽! > > > -- > Yours, > fluke > fluke at sfcube.net > http://blog.ospattern.net > -- Yours, fluke fluke at sfcube.net http://sfcube.net/blog -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060121/822c59b6/attachment.html
Zeuux © 2025
京ICP备05028076号