[mod_python] Newbie - problem running mptest.py

Graham Dumpleton grahamd at dscpl.com.au
Fri Jun 16 21:52:48 EDT 2006


Most likely because you have more than one version of Python installed.
When you use the "rc" script it is hardwiring path to look in only  
standard
locations but the version of Python found in PATH when that is done  
hasn't
had mod_python installed. When you use /sbin/service it is probably
using your own PATH which is finding a different version of Python for
which mod_python has been installed.

So, work out how many versions of Python you have installed, what their
respective version numbers are and whether mod_python got installed
for each version or not. The PATH environment used when Apache is
run must find the one for which mod_python was installed.

Graham

On 17/06/2006, at 8:30 AM, John Cartwright wrote:

> Hi Karl,
>
> I'm not sure why, but for me it makes a difference if you restart  
> apache
> with:
> /sbin/service httpd restart
> vs.
> /etc/rc.d/init.d/httpd restart
>
> The former seems to work w/ mod_python, the latter doesn't.
>
> -- john
>
>
> Karl Kobata wrote:
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> *From:* Karl Kobata [mailto:karl.kobata at syncira.com]
>> *Sent:* Wednesday, March 01, 2006 2:15 PM
>> *To:* 'mod_python at modpython.org'
>> *Subject:* FW: Newbie - problem running mptest.py
>>
>> Please help.
>>
>> thanks
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> *From:* Karl Kobata [mailto:karl.kobata at syncira.com]
>> *Sent:* Tuesday, February 28, 2006 3:00 PM
>> *To:* 'mod_python at modpython.org'
>> *Subject:* Newbie - problem running mptest.py
>>
>> I am new to mod_python.
>>
>> This DSO module was included in Redhat RHEL 3, but I do not seem  
>> to be
>> able to get this working with the simple example test program. See
>> questions below.
>>
>> Redhat Linux RHEL 3
>>
>> Apache 2.0.46
>>
>> Mod_python 3.0.3
>>
>> RHEL 3 configuration:
>>
>> /etc/httpd/conf/httpd.conf
>>
>> - in this file it includes external configuration files
>>
>> - For mod_python, it httpd.conf includes /etc/httpd/conf.d/ 
>> python.conf
>>
>> - In python.conf, these directives were added:
>>
>> LoadModule python_module modules/mod_python.so
>>
>> <Directory /<DocumentRoot path>/Python>
>>
>> AddHandler python-program .py
>>
>> PythonHandler mptest
>>
>> PythonDebug On
>>
>> </Directory>
>>
>> Example file:
>>
>> Mptest.py
>>
>> from mod_python import apache
>>
>> def handler(req):
>>
>> req.write("Hello World!")
>>
>> return apache.OK
>>
>> URL reference:
>>
>> http://localhost/Python/mptest.py
>>
>> Results:
>>
>> 1) the content of mptest.py was displayed, and not executed.
>>
>> 2) Error message in error.log for apache
>>
>> [Tue Feb 28 14:24:35 2006] [error] make_obcallback: could not import
>> mod_python.apache.!
>>
>> Could not find platform independent libraries <prefix>
>>
>> Could not find platform dependent libraries <exec_prefix>
>>
>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>
>> 'import site' failed; use -v for traceback
>>
>> 'import site' failed; use -v for traceback
>>
>> ImportError: No module named mod_python.apache
>>
>> Question:
>>
>> 1) what did I do wrong?
>>
>> 2) How to you use –v for traceback
>>
>> 3) Any other suggestion
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> _______________________________________________
>> 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




More information about the Mod_python mailing list