[mod_python] mod_python tutorial issues

Nilesh Govindrajan admin at itech7.com
Mon Mar 17 21:54:22 EDT 2008


Joseph, I am sending a CC of this mail to Apache Mailing list. I will 
tell you if any replies are received.

Apache Mailing List: Please solve Joseph's problem with Apache, 
mod_python on windows xp sp2. please read all the messages in here (quotes).

Joseph Sliz wrote:
> Sorry for the delay in responding....had a meeting.
>
> I've tried setting up the directory with quotes and no-quotes.  I changed
> the DocumentRoot Directory back to what it was originally:
>
> <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
>
> I've moved my hello.py module into that folder and now I receive a "500
> Internal Server Error" when I try to access http://localhost/hello.py.
>
> The error report is as follows:
>
> ImportError: No module named mod_python.apache
> [Mon Mar 17 13:48:11 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']".
> [Mon Mar 17 13:48:11 2008] [error] get_interpreter: no interpreter callback
> found.
> [Mon Mar 17 13:48:11 2008] [error] [client 127.0.0.1] python_handler: Can't
> get/create interpreter.
> [Mon Mar 17 13:50:55 2008] [notice] Parent: Received restart signal --
> Restarting the server.
> [Mon Mar 17 13:50:55 2008] [notice] Child 3324: Exit event signaled. Child
> process is ending.
> [Mon Mar 17 13:50:55 2008] [notice] Apache/2.2.8 (Win32) configured --
> resuming normal operations
> [Mon Mar 17 13:50:55 2008] [notice] Server built: Jan 18 2008 00:37:19
> [Mon Mar 17 13:50:55 2008] [notice] Parent: Created child process 3936
> [Mon Mar 17 13:50:55 2008] [notice] mod_python: Creating 8 session mutexes
> based on 0 max processes and 64 max threads.
> [Mon Mar 17 13:50:55 2008] [notice] Child 3936: Child process is running
> [Mon Mar 17 13:50:56 2008] [notice] Child 3324: Released the start mutex
> [Mon Mar 17 13:50:56 2008] [notice] Child 3936: Acquired the start mutex.
> [Mon Mar 17 13:50:56 2008] [notice] Child 3936: Starting 64 worker threads.
> [Mon Mar 17 13:50:57 2008] [notice] Child 3324: All worker threads have
> exited.
> [Mon Mar 17 13:50:57 2008] [notice] Child 3324: Child process is exiting
> [Mon Mar 17 13:50:57 2008] [notice] Child 3936: Starting thread to listen on
> port 80.
> [Mon Mar 17 13:51:15 2008] [error] make_obcallback: could not import
> mod_python.apache.\n
> 'import site' failed; use -v for traceback
> 'import site' failed; use -v for traceback
> ImportError: No module named mod_python.apache
> [Mon Mar 17 13:51:15 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']".
> [Mon Mar 17 13:51:15 2008] [error] get_interpreter: no interpreter callback
> found.
> [Mon Mar 17 13:51:15 2008] [error] [client 127.0.0.1] python_handler: Can't
> get/create interpreter.
>
>
> Any ideas??
>
> Regards...Joe
>
> -----Original Message-----
> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
> Sent: Monday, March 17, 2008 11:39 AM
> To: jsliz at fluentenergy.com
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] mod_python tutorial issues
>
> Joseph Sliz wrote:
>   
>> The tutorial examples I have are as follows:
>>
>> DocumentRoot /foo/bar
>> <Directory /foo/bar>
>> 	AddHandler python-program .py
>> 	PythonHandler hello
>> </Directory
>>
>>
>> AND
>>
>> Alias /python /var/www/python
>> <Directory /var/www/python>
>>         SetHandler python-program
>>         PythonHandler application
>> </Directory>
>>
>>
>> Not knowing much about mod_python and Apache, I can only go by the
>>     
> examples.
>   
>> Should I be setting the Directory up differently in the Apache httpd.conf
>> file???
>>
>>
>>
>> -----Original Message-----
>> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
>> Sent: Monday, March 17, 2008 11:15 AM
>> To: jsliz at fluentenergy.com
>> Cc: mod_python at modpython.org
>> Subject: Re: [mod_python] mod_python tutorial issues
>>
>> Joseph Sliz wrote:
>>   
>>     
>>> Still didn't work.  I tried visiting http://localhost/hello.py/handler,
>>>     
>>>       
>> but
>>   
>>     
>>> still receive an "HTTP 404 Not Found" error.  What could I possibly be
>>> missing???
>>>
>>> Regards....Joe
>>>
>>> -----Original Message-----
>>> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
>>> Sent: Monday, March 17, 2008 11:02 AM
>>> To: jsliz at fluentenergy.com
>>> Cc: mod_python at modpython.org
>>> Subject: Re: [mod_python] mod_python tutorial issues
>>>
>>> Joseph Sliz wrote:
>>>   
>>>     
>>>       
>>>> Nilesh;
>>>>
>>>> I've changed the following code in the Apache httpd.conf file:
>>>>
>>>> DocumentRoot /C:/temp
>>>> <Directory /C:/temp>
>>>>     AddHandler mod_python .py
>>>>     SetHandler mod_python 
>>>>     PythonHandler hello
>>>> </Directory>
>>>>
>>>> But, I am still receiving an "HTTP 404 Not Found" error when I put the
>>>> request "http://localhost/hello.py" into my browser.  Should I be
>>>>         
> placing
>   
>>>> the above piece of code in a certain spot in the Apache httpd.conf
>>>>       
>>>>         
>> file???
>>   
>>     
>>>> Regards.....Joe
>>>>
>>>> -----Original Message-----
>>>> From: Nilesh Govindrajan [mailto:admin at itech7.com] 
>>>> Sent: Monday, March 17, 2008 10:41 AM
>>>> To: jsliz at fluentenergy.com
>>>> Cc: mod_python at modpython.org
>>>> Subject: Re: [mod_python] mod_python tutorial issues
>>>>
>>>> Joseph Sliz wrote:
>>>>   
>>>>     
>>>>       
>>>>         
>>>>> I am new to mod_python and Apache.
>>>>>
>>>>> My environment is:
>>>>>  
>>>>> Windows XP Prof sp2
>>>>> Python 2.4
>>>>> Apache 2.2.8
>>>>> Mod_python 3.3.1
>>>>>  
>>>>> I've already added the following to the Apache httpd.conf
>>>>>  
>>>>> LoadModule python_module modules/mod_python.so
>>>>>  
>>>>> I'm now trying to do a simple test, following a tutorial I found.  I've
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> also added the following to the Apache httpd.conf file to let Mod_python
>>>> know where to find my python module
>>>>   
>>>>     
>>>>       
>>>>         
>>>>>  
>>>>> DocumentRoot /C:/temp
>>>>> <Directory /C:/temp>
>>>>>     AddHandler python-program .py 
>>>>>     PythonHandler hello
>>>>> </Directory>
>>>>>  
>>>>>  
>>>>> I have added the following python script to my "C:/temp" directory.
>>>>>  
>>>>> from mod_python import apache
>>>>>  
>>>>> def handler(req):
>>>>>      req.content_type = "text/plain"
>>>>>      req.send_http_header()
>>>>>      req.write("Hello, Welcome to my World!")
>>>>>      return apache.OK
>>>>>  
>>>>>  
>>>>> When I put the request "http://localhost/hello.py" into my browser, I
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> receive an "HTTP 404 Not Found" error.  Can anyone please give me some
>>>> assistance as to what I might be doing wrong??
>>>>   
>>>>     
>>>>       
>>>>         
>>>>>  
>>>>> Reqards..Joe
>>>>>  
>>>>> / /
>>>>>
>>>>>
>>>>>           
> ------------------------------------------------------------------------
>   
>>>>> _______________________________________________
>>>>> Mod_python mailing list
>>>>> Mod_python at modpython.org
>>>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>> Try with
>>>>
>>>> AddHandler mod_python .py
>>>>
>>>> and
>>>>
>>>> SetHandler mod_python
>>>>
>>>> note: you must AddHandler first otherwise it won't work.
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> try visiting http://localhost/hello.py/handler
>>>
>>> if it works;
>>>
>>> then add this code in hello.py
>>>
>>> def index(req):
>>> return handler(req)
>>>
>>>   
>>>     
>>>       
>> Are you sure that the directory is set correctly ? /C: ???
>> I am on Linux so don't know much about Apache in Windows.
>>
>>   
>>     
> The python-program handler never works for me. So, I always use
> AddHandler mod_python .py
>
> But I asked you whether you are right in setting up the directories 
> /C:/temp .
>
> May be they need to be surrounded by quotes "/C:/temp" in DocumentRoot 
> and <Directory>
>
>   



More information about the Mod_python mailing list