[Tutor] Help with 500 error on cgi script

Sheila King sheila@spamcop.net
Sun, 18 Mar 2001 01:33:57 -0800


OK, I'm at my wits end.

I have Apache running on my local Win98 machine, and I have one simple python
cgi script, equivalent to "Hello, World!", that I have been able to run.

Today I thought I would start to play with the cgi module and start doing some
forms and so forth.

Well, I was getting 500 internal server errors. I've checked everything. The
path, etc...

So, finally, I tried just running cgi.test(), as recommended in the Python
tutorial. It worked splendidly.

I also have the Python Core Programming book, from Wesley Chun, that comes
with a CD-ROM and I put up his friends.htm and friends1.py files from the CD
onto my local site, and it ran just fine, also.

I've compared my file to the other two files and just can't see what I'm doing
wrong.

So, here is my script. I'm sure someone here will see it right off?

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


#!/usr/bin/env python


import cgi

form = cgi.FieldStorage()
form_ok = 0
    
if form.has_key("subscriberEmail") and form.has_key("command"):
    form_ok = 1
if not form_ok:
	output = '''Content-type: text/html\n\n
<html>
<Head>
<Title>Error in Form</Title>
</Head>\n
<Body>\n
<H1>Error</H1>
You have not filled out all necessary information to complete this request
You <b>MUST</b> fill in your subscriber e-mail in the From: box
and you <b>MUST</b> select some action to modify your delivery options.
Please use the back button on your browser to return to the form and fill
in the required information
</body>\n</html>
'''
	print output
else:
	for k in form.keys():
    	print k, " : ", form[k]
	print "All done!"