On Sun, 06 May 2007 21:30:16 -0700, Adrian Smith wrote: > The support guy looked at it and gave me this: > > Traceback (most recent call last): > File "python1.cgi", line 6, in ? > print form["essay"].value > File "/usr/local/lib/python2.4/cgi.py", line 559, in __getitem__ raise > KeyError, key > KeyError: 'essay' > > (http://www.profusehost.net/forum/support/10894-cgi-blink.html) > > He says I have a syntax error, though I'm b*ed if I can see where it > could be. Can anyone here suggest anything?
Oh lordy lordy lordy, you've got one fine example of incompetence in action. >From the support forum: [quote] Quote: perl python1.cgi \Semicolon seems to be missing at python1.cgi line 3. syntax error at python1.cgi line 4, near "form " Execution of python1.cgi aborted due to compilation errors. Quote: perl -p python1.cgi Semicolon seems to be missing at python1.cgi line 3. syntax error at python1.cgi line 4, near "form " Execution of python1.cgi aborted due to compilation errors. [end quote] The "administrator" John is trying to execute a Python script with Perl. I notice that you pointed that out to him, and his response was: [quote] Sorry for delay. if we try to run this script by python we will get same error. python -t python1.cgi Content-type: text/html Traceback (most recent call last): File "python1.cgi", line 6, in ? print form["essay"].value File "/usr/local/lib/python2.4/cgi.py", line 559, in __getitem__ raise KeyError, key KeyError: 'essay' we can test perl or cgi scripts using perl command. PLease fix syntax error so it will work fine. [end quote] It is NOT the same error. There are NO syntax errors in the script, there is a runtime error. The so-called administrator is wrong: you can't use Perl to test just any old CGI scripts. They have to be written in Perl. I see from the source code on your page that you have a line: <TEXTAREA NAME="essay" COLS=60 ROWS=20 WRAP=HARD></TEXTAREA> You have two lines in your cgi script: form = cgi.FieldStorage() print form["essay"].value Having never done cgi programming, I'm not sure what the problem is, but after reading help(cgi) I'll take a stab in the dark and say try this: print form.value It might also help for you to try this: print form.keys() Good luck with the "admins" at your hosting company. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list