Debugging CGI tips wanted...

Chris Lyon chris.lyon at spritenote.co.uk
Fri May 16 06:30:56 EDT 2003


"John D." <lists at webcrunchers.com> wrote in message news:<mailman.1053063475.30996.python-list at python.org>...
> I'm trying to debug a CGI.   Am using the "post" method,  and want to emulate the "stdin" from within a Python shell,  exactly as if the python module were called from a CGI.
> 
> As you know,  the "post" method passes the forms parameters into data passed to the CGI via Stdin.
> 
> I want to know if there's a way to emulate this from the Python command line,  to make debugging easier.
> 
> Another question....  How can I tell if a Python veriable is undefined at runtime.
> 
> John

You don't say which version of python you are using but if it's recent 
try adding 

import cgitb; cgitb.enable()

at the top of the code. IT really helps with cgi debugging.




More information about the Python-list mailing list