Okay, so it looks like you don't need that first line. It should be obvious to try this as the start of your code then:
import cgitb
import cgi
cgitb.enable()
print "Content-type: text/html\n\n"
To replace what I proposed earlier:
#!c:/python24/python
import cgitb
import cgi
cgitb.enable()
print "Content-type: text/html\r"
print "\r"