[mod_python] HELP needed for Mod_python & Apache on a Win XP machine

Nilesh Govindrajan admin at itech7.com
Tue Mar 18 12:53:09 EDT 2008


Joseph Sliz wrote:
>
> UPDATE!!!
>
> I have added a directory “test” to the following:
>
> <Directory "C:/Program Files/Apache Software 
> Foundation/Apache2.2/htdocs/test">
>
> Now when I put http://localhost/hello.py in my browser(IE) I receive 
> the code for the hello.py file in the browser and the following in the 
> Apache error log:
>
> ImportError: No module named mod_python.apache
>
> [Tue Mar 18 12:38:14 2008] [error] make_obcallback: Python path being 
> used "['C:\\\\Python24\\\\python24.zip', '.\\\\DLLs', '.\\\\lib', 
> '.\\\\lib\\\\plat-win', '.\\\\lib\\\\lib-tk', 'C:\\\\Program 
> Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']".
>
> [Tue Mar 18 12:38:14 2008] [error] get_interpreter: no interpreter 
> callback found.
>
> [Tue Mar 18 12:38:14 2008] [error] [client 127.0.0.1] python_handler: 
> Can't get/create interpreter.
>
> [Tue Mar 18 12:39:30 2008] [notice] Parent: Received restart signal -- 
> Restarting the server.
>
> [Tue Mar 18 12:39:30 2008] [notice] Child 176: Exit event signaled. 
> Child process is ending.
>
> [Tue Mar 18 12:39:30 2008] [notice] Apache/2.2.8 (Win32) configured -- 
> resuming normal operations
>
> [Tue Mar 18 12:39:30 2008] [notice] Server built: Jan 18 2008 00:37:19
>
> [Tue Mar 18 12:39:30 2008] [notice] Parent: Created child process 640
>
> [Tue Mar 18 12:39:30 2008] [notice] mod_python: Creating 8 session 
> mutexes based on 0 max processes and 64 max threads.
>
> [Tue Mar 18 12:39:30 2008] [notice] Child 640: Child process is running
>
> [Tue Mar 18 12:39:31 2008] [notice] Child 640: Acquired the start mutex.
>
> [Tue Mar 18 12:39:31 2008] [notice] Child 176: Released the start mutex
>
> [Tue Mar 18 12:39:31 2008] [notice] Child 640: Starting 64 worker threads.
>
> [Tue Mar 18 12:39:31 2008] [notice] Child 640: Starting thread to 
> listen on port 80.
>
> [Tue Mar 18 12:39:32 2008] [notice] Child 176: All worker threads have 
> exited.
>
> [Tue Mar 18 12:39:32 2008] [notice] Child 176: Child process is exiting
>
> Regards….Joe
>
> *From:* mod_python-bounces at modpython.org 
> [mailto:mod_python-bounces at modpython.org] *On Behalf Of *Joseph Sliz
> *Sent:* Tuesday, March 18, 2008 12:21 PM
> *To:* mod_python at modpython.org
> *Subject:* [mod_python] HELP needed for Mod_python & Apache on a Win 
> XP machine
>
> My environment is as follows:
>
> Windows XP Prof 2002 sp2
>
> > Python 2.4.3
>
> > Apache 2.2.8
>
> > mod_python 3.3.1
>
> I have added the following lines to the Apache httpd.conf file:
>
> LoadFile "C:/Python24/Python24.dll"
>
> LoadModule python_module modules/mod_python.so
>
> Servername is the following:
>
> ServerName localhost:80
>
> Under the “DocumentRoot” section of the Apache httpd.conf file, I 
> changed the following:
>
> <Directory/>
>
> Options FollowSymLinks
>
> AllowOverride None
>
> Order deny,allow
>
> Deny from all
>
> </Directory>
>
> TO:
>
> <Directory "C:/Program Files/Apache Software 
> Foundation/Apache2.2/htdocs/">
>
> AddHandler mod_python .py
>
> PythonHandler hello
>
> PythonDebug On
>
> Options FollowSymLinks
>
> AllowOverride None
>
> Order deny,allow
>
> Deny from all
>
> </Directory>
>
> The rest of the Apache httpd.conf file is the same as was when Apache 
> 2.2.8 was installed
>
> I have added the following python module to the Apache2.2/htdocs 
> directory:
>
> From mod_python import apache
>
> Def handler(req):
>
> req.content_type = ‘text/plain’
>
> req.write(“Hello World!”)
>
> return apache.OK
>
> When I enter the request http://localhost/ into my browser(IE) I 
> receive “It Works” from the index.html file contained in the 
> Apache2.2/htdocs directory……..This is good.
>
> When I enter the request http://localhost/hello.py into my browser(IE) 
> I receive the following:
>
> *Internal Server Error*
>
> The server encountered an internal error or misconfiguration and was 
> unable to complete your request.
>
> Please contact the server administrator, admin at localhost and inform 
> them of the time the error occurred, and anything you might have done 
> that may have caused the error.
>
> More information about this error may be available in the server error 
> log.
>
> The message I get in the server error log is as follows:
>
> ImportError: No module named mod_python.apache
>
> [Tue Mar 18 12:11:04 2008] [error] make_obcallback: Python path being 
> used "['C:\\\\Python24\\\\python24.zip', '.\\\\DLLs', '.\\\\lib', 
> '.\\\\lib\\\\plat-win', '.\\\\lib\\\\lib-tk', 'C:\\\\Program 
> Files\\\\Apache Software Foundation\\\\Apache2.2\\\\bin']".
>
> [Tue Mar 18 12:11:04 2008] [error] get_interpreter: no interpreter 
> callback found.
>
> [Tue Mar 18 12:11:04 2008] [error] [client 127.0.0.1] python_handler: 
> Can't get/create interpreter
>
> Can someone please help me with this issue. I have no other version of 
> python installed on my pc. I have installed and re-installed both 
> Apache and Mod_python to no success. Can anyone please shed some light 
> on what the problem is??? It shouldn’t be this hard!!!
>
> Joseph Sliz, Jr.
>
> Data Analyst/Programmer
>
> jsliz at fluentenergy.com <mailto:jsliz at fluentenergy.com>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>   
Remove two things from the python code -

1. from mod_python import apache
2. return apache.OK

try now. hope it works.


More information about the Mod_python mailing list