469,592 Members | 1,729 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

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

Say I have have an HTML form , the user hits the submit button and I
what text they enetered into a HTML form field is written to a file.

But I don't have PHP, JAVA the usual client or server sided layers to
write the data to a file, and I'm not to keen on JavaScript. Note: I
can not add or download anything, I must use what I have.

But I have Python 2.1 and I'm on a WinXP desktop with the win32.com,
and usual active-x objects, MS-Office ect - what'd normally locally on
an XP work station.

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?

If there isn't a web form way, could there be another way to get a box
to come up with input fields with the capability to submit the data to
a file?

Thanks,
Lee G.

Aug 4 '07 #1
3 1659
goldtech <go******@worldpost.comwrites:
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.
Aug 4 '07 #2
Paul Rubin wrote:
goldtech <go******@worldpost.comwrites:
>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
Aug 4 '07 #3
En Sat, 04 Aug 2007 19:17:35 -0300, Jay Loden <py****@jayloden.com>
escribió:
Paul Rubin wrote:
>goldtech <go******@worldpost.comwrites:
>>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

CGIHTTPServer is not available on Windows (OP said they are on Win XP)
CGIHTTPServer does work on Windows (even on Python 2.1, as far as I can
go) and using it might be simple enough.
due to
use of fork and exec to execute the CGI.
CGIHTTPServer uses popen2 or popen3 if available.
I suggested a few other options in my
reply, but unfortunately CGIHTTPServer is not an option for this task.
I can't see any other reply from you on this thread... (I'm using the
gmane newsgroup interfase)

--
Gabriel Genellina

Aug 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark Michel | last post: by
5 posts views Thread by José Carlos | last post: by
9 posts views Thread by Eric George | last post: by
5 posts views Thread by Navillus | last post: by
12 posts views Thread by Daniel Klein | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.