can i use the browser to show the result of python

Dave Angel davea at ieee.org
Fri Sep 25 06:27:33 EDT 2009


Hacken wrote:
> I have write some python script
>
> i want to use browser(IE or FF) to call it, an show the returns!
>
> how to?
>
>   
You don't say much about your environment, nor the nature of your 
script. So my response will be very generic.


If your script writes a valid html/xml/xhtml format to stdout, then you 
could put the script onto a web server with cgi enabled, and mark it 
executable.  Then you could enter the URL for that cgi file into your 
browser, and see that generated web page.

Interesting additional gotchas:  You need rights to upload (ftp) to such 
a server.  The server needs to have an appropriate Python available, and 
configured to permit cgi access for files with the .py extension.  
Further, if the server is Unix, your file must be in Unix text format, 
with a shebang line that matches the location of the appropriate version 
of python on that particular server.

DaveA




More information about the Python-list mailing list