To use a Python program as a CGI script, you must import the cgi module. For purposes of troubleshooting your script, you should also import the module cgitb. This provides alternative exception handlers which offer more informative error messages in the event of an exception. While you can write CGI scripts without cgitb, it is recommended for its helpful exception handling.
If you have trouble running your CGI scripts, remember to check your permissions and the setup of your Apache server. If you do not have administrator access to your web server, check with someone who does. Other important items to keep in mind are found at About.com's Webdesign site.
