By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,941 Members | 1,789 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,941 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.