[Tutor] Exception and sys.exit() in a cgi script

Paulino paulino1 at sapo.pt
Sun Oct 15 18:09:34 CEST 2006


This is a peace of a CGI script i have.

1 import cgi
2 form=cgi.FieldStorage()
3 try :
4     ano=form["ano"].value
5     conta=form["conta"].value
6 except KeyError :
7     print '<html><br><br><body><p>Please enter values in the
fields</p></body></html> '
8     sys.exit(0)


When the excption occurs, no message is shown on the browser.

If I run the script with IDLE, the message is printed and then the
script exits.

What's wrong here?





More information about the Tutor mailing list