Webform python cgi issue

Steve Holden sholden at holdenweb.com
Sun Oct 7 17:33:38 CEST 2001


"tefol" <tefol at This.Is.Not.An.Address> wrote in message
news:9134D587tefolThisIsNotAnAddr at 61.9.128.12...
> tefol at This.Is.Not.An.Address (tefol) wrote in
> <9133E264AtefolThisIsNotAnAddr at 61.9.128.12>:
>
> >Hiya everyone....
> >
>
> <snipped pickled form>
>
>
>
> >What the heck is all that stuff?
>
>
>
> I figured out what all that stuff was now.  That is what pickling does to
s
> a form.
>
>
> So instead of pickling what I am returning,  I have altered the
> FeedbackData thus:
>
> class FeedbackData(FormData):
>     fieldnames = ('field1', 'field2', 'field3', 'field4', 'field5')
>     def __repr__(self):
>         return 'Field1 = %(field1)s \nField2 = %(field2)s \nField3 =
> %(field3)s \nField4 = %(field4)s' % vars(self)
>
>
> This works great, proved when I exit the script like this:
>
> data = FeedbackData(form)
>
> print "Content-type: text/html\n\n"
> print "<h3><center>You did it!</center></H3>"
> print data
> sys.exit()
>
> I get exactly what I want displayed in my browser.  Only thing is when I
> try:
>
> output = open('/home/nemir/output/output.txt', 'w')
> output.write(data)
> output.close()
>
>
> I get this in my apache error log:
>
> malformed header from script. Bad header=  File "/home/nemir/public_htm:
> /home/nemir/public_html/cgi-bin/inputform.py
>
>
> What is the "/home/nemir/public_htm: "???    the directory is public_html!
> not htm....  And where does that colon come from?  Is this something I
> should post on the apache ng?
>
> again,  TIA
If you want to show the from in your browser, and tha second code is a
separate VGI scriptm, try starting it with

    print "Content-Type text/plain\n"

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list