[mod_python] Apache2 unable to run my python script

Graham Dumpleton grahamd at dscpl.com.au
Sat Mar 12 05:51:34 EST 2005


Your Apache config most likely doesn't define a default content type
and you used:

     from mod_python import apache

     def handler(req):
         req.write("Hello World!")
         return apache.OK

Instead of that, use:

     from mod_python import apache

     def handler(req):
         req.content_type = "text/plain"
         req.write("Hello World!")
         return apache.OK

You will need to be clearer about what you are getting though. Does what
FireFox saves have the desired content in it, or does it contain the
Python code used to produce it? The latter indicates other configuration
problems.

Suggest if the above doesn't help, make sure you supply all the  
following:

	• 	Whether you are using the global configuration file or a .htaccess  
file.
	• 	The snippet of the Apache configuration you are using to configure  
mod_python
          and enable its use in the directory you are working in.
	• 	The full contents of the Python code file for the content handler  
you are trying to use.

Without this we would be largely guessing based on what are common  
problems.

Graham

On 12/03/2005, at 9:30 PM, noel villamor wrote:

> When I access a python script from a Firefox, I am prompted to
> download the .py file.
>
> I followed the instructions stated in:
> http://172.29.15.14/doc/libapache2-mod-python-doc/doc-html/inst- 
> testing.html
>
> I am using Apache/2.0.52 (Debian Testing) mod_python/3.1.3  
> Python/2.3.5.
>
> Hints please.
> _______________________________________________
> 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