Submit web form only client-side with Python? COM?

Jay Loden python at jayloden.com
Sat Aug 4 18:17:35 EDT 2007


Paul Rubin wrote:
> goldtech <goldtech at worldpost.com> writes:
>> So I can present the user with an HTML form in it - but how can I
>> write the form data to a local file on my work station?
> 
> The simplest way is with the cgi and CGIHTTPServer modules.  You'd
> write your form in an html file, with the target set to a Python
> script that you'd write as a cgi.  Then you'd write a trivial CGI HTTP
> server (look at the example code in the comments) with CGIHTTPServer.
> The user would point their browser at your server (you could make a
> desktop shortcut for that), the browser shows the html file, and the
> submit button sends the form contents to your cgi.
> 
> This is very basic, old-school web programming, not as flexible or
> high-performance as using the fancy frameworks, but a lot simpler for
> limited applications like what you're describing.

CGIHTTPServer is not available on Windows (OP said they are on Win XP) due to
use of fork and exec to execute the CGI. I suggested a few other options in my
reply, but unfortunately CGIHTTPServer is not an option for this task.

-Jay



More information about the Python-list mailing list