PYthon Script erzeugt Apache-Fehlermeldung
Verfasst: Donnerstag 5. Mai 2005, 18:10
Hallo
ich habe ein kleines Problem mit meinem Apache-Script. Während dieses hier einwandfrei funktioniert:
erzeugt dieses:
folgende Fehlermeldung:
ich habe ein kleines Problem mit meinem Apache-Script. Während dieses hier einwandfrei funktioniert:
Code: Alles auswählen
#!/usr/bin/python
import cgi
form = cgi.FieldStorage() # parse form data
print "Content-type: text/html\n" # plus blank line
html_header = "<html><body><title>Py-CGI T-002 -- Output-T001</title><h1>Result</h1><hr />"
last_f = "<p>Lastname: %s</p>"
first_f = "<p>Firstname: %s</p>"
nick_f = "<p>Nickname: %s</p>"
mail_f = "<p>e-Mail: %s</p>"
pass1_f = "<p>Password: %s</p>"
pass2_f = "<p>Retype %s</p>"
html_footer ="</body></html>"
if form.has_key('lastname'):
last = ['lastname'].value
else:
last = "none"
if form.has_key('firstname'):
first = form['firstname'].value
else:
first = "none"
if form.has_key('nickname'):
nick = form['nickname'].value
else:
nick = "none"
if form.has_key('e-mail'):
mail = form['e-mail'].value
else:
mail = "none"
if form.has_key('password1'):
pass1 = form['password1'].value
else:
pass1 = "none"
if form.has_key('password2'):
pass2 = form['password2'].value
else:
pass2 = "none"
print html_header
print last_f % (form['last'].value)
print first_f % (form['first'].value)
print nick_f % (form['nick'].value)
print mail_f % (form['mail'].value)
print pass1_f % (form['pass1'].value)
print pass2_f % (form['pass2'].value)
print html_footer
Code: Alles auswählen
#!/usr/bin/python
import cgi, cgitb
cgitb.enable()
form = cgi.FieldStorage() # parse form data
print "Content-type: text/html\n" # plus blank line
html_header = "<html><body><title>Py-CGI T-002 -- Output-T001</title><h1>Result</h1><hr />"
field = """
<p>Lastname: %s</p>\n
<p>Firstname: %s</p>\n
<p>Nickname: %s</p>\n
<p>e-Mail: %s</p>\n
<p>Password: %s</p>\n
<p>Retype %s</p>
"""
html_footer ="</body></html>"
if form.has_key('lastname'):
last = ['lastname'].value
else:
last = "none"
if form.has_key('firstname'):
first = form['firstname'].value
else:
first = "none"
if form.has_key('nickname'):
nick = form['nickname'].value
else:
nick = "none"
if form.has_key('e-mail'):
mail = form['e-mail'].value
else:
mail = "none"
if form.has_key('password1'):
pass1 = form['password1'].value
else:
pass1 = "none"
if form.has_key('password2'):
pass2 = form['password2'].value
else:
pass2 = "none"
print html_header
print field % (last, first, nick, mail, pass1, pass2)
print html_footer
Woran liegt das? Die Scripts sollten doch vom Resultat her eigentlich identisch sein, oder?Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, none@none.ch and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.