Last Problem, I Think, In CGI Script: Please Help
rainy
sill at localhost.debian.org
Thu May 3 23:06:02 EDT 2001
On Thu, 03 May 2001 18:21:23 -0700, Ben Ocean <zope at thewebsons.com> wrote:
>Hi;
>I frame around a Web page from Kelley Blue Book on my car dealer's site.
>KBB has the visitor fill out a form. The data is then posted back to my car
>dealer's site via STDIN. I capture the data via cgi.FieldStorage(). I test
>to see if a certain variable of my own making is valid. If it is not, I
>raise a NameError exception and print to screen the data the visitor filled
>out in the form. Then I offer the visitor the opportunity to have this data
>sent back to the dealership or, conversely, printed to screen in a
>printer-friendly format. I do this by writing the data to a separate file
>at the same time as I originally post the data to the screen. The problem
>comes in when I try and retrieve the data from the file. When the visitor
>selects one of the aforementioned options, the variable of my own making
>for which I test (which the first time around threw the NameError
>exception) is set in STDIN in the URL and the same script is called. The
>page is printed to screen and the data is supposed to be read from the file
>I'd written, but for some reason it isn't! The data's in there, so what
>gives? Here's the part that's not working:
> >>>
> file = open("outfile.txt", "r")
> print file
><<<
>Should work, right? Your help is appreciated. The entire file follows if
>you care to look for errors, although I've tested the rest and it appears
>to be in good, working order.
This shouldn't work, actually.. the way you intend. Read tutorial or a
good introductory book to find out how to do this properly.
Hope this helps.
--
Shine on you crazy diamond / - Roger
- Andrei
More information about the Python-list
mailing list