If you're using CGI - and it sounds like you are, the things you need to do are;
Now click the link again, and with cgi-traceback (cgitb) enabled, you should get a Python traceback as well as the error message, so you can see what went wrong. Great for development, but remember to turn it off before you finish, it's not a very pretty sight for users
# Change the content-type as appropriate
print "Content-type: text/plain\n\n"
# code goes here
print "Hello from my cgi script"