[mod_python] Browser saves script output to file instead

David Fraser davidf at sjsoft.com
Wed Jan 28 08:02:50 EST 2004


Jim wrote:

>Mod_Python'ers,
>
>I am having a problem with mod_python. Basically whats happening is when
>I attempt to load a script in the web browser rather then execute the
>script and display the output in the browser, I am prompted to save the
>script. If you save the script you will find the output you would have
>expected to be displayed in the browser. In other words, it doesn't save
>the script, it parses the script and saves the output.
>
>I followed the directions in the html documentation.
>       
>	   <Directory /var/www/test/python>
>                AddHandler python-program .py
>                #PythonHandler mod_python.publisher
>                PythonHandler mptest
>                PythonDebug On
>        </Directory>
>
>note: When I try the above with the publisher uncommented I get a 404.
>
>I have tried the below. I have tried with the application type set to
>x-python and x-httpd.py and I have tried with no AddType at all. Neither
>make a difference.
>
>AddType appliction/x-httpd-py .py  
>AddType appliction/x-python .py
>  
>
Maybe you want AddType text/plain .py
Otherwise your browser won't know what to do with it?

>The error.log for apache looks like this. The below line is displayed
>over and over again.
>
>[Tue Jan 27 21:26:56 2004] [notice] mod_python: (Re)importing module
>'mptest'
>
>The script mptest is exactly as it is explained in the online docs.
>
>This is the output from starting python2.3 in the command line and
>trying the same import from mptest. I don't know if this should be
>expected or not.
>
>  
>
>>>>from mod_python import apache
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 67,
>in ?
>    import _apache
>ImportError: No module named _apache
>
>I am running Debian unstable. mod_python 3.0.4-2 on apache 2.0.48-4
>
>Any suggestions would be very much appreciated.
>
>- Jim
>
>_______________________________________________
>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