[Tutor] debugging CGI hints

Lloyd Kvam pythontutor@venix.com
Thu, 07 Mar 2002 09:01:01 -0500


I am sure you have figured out that "Internal Server Error" means the script
could not be run - any thing from syntax error to permissions or owner problems.

I have found it helpful to keep a test script around that simply echos the parameters
that got fed in.  This comes into play when you are debugging  HTML / script
interactions.
::::::::::::::::::::::
#!/usr/local/bin/python
import cgi

print "Content-type: text/html\n"
cgi.test()
::::::::::::::::::::::

Also, you may already have been warned that
	#! /usr/local/env python
may fail if the owner of the httpd server does not have a "normal" setup.  A direct
reference to Python may be safer.  Since your cgi scripts are in known locations, it
is not too hard to change them all if Python gets moved.


Tim Wilson wrote:

> Hi everyone,
> 
> I've got apache configured to run Python-based CGI scripts on my home
> directory now. Thanks for the tips. Now that I'm working on some simple
> scripts, I'm finding the debugging to be difficult. Any problems with
> the scripts generate an "Internal Server Error" in the browser and I
> don't get any specific error messages.
> 
> Any tips for debugging CGI scripts?
> 
> -Tim
> 
> --
> Tim Wilson      |   Visit Sibley online:   | Check out:
> Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
> W. St. Paul, MN |                          | http://slashdot.org
> wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582