debugging CGI scripts

thanos vassilakis thanos at 0x01.com
Tue Aug 22 06:19:41 EDT 2000


Harry George wrote:

> cgipm has a "die" function.  See:
> http://www.seanet.com/~hgg9140/comp/index.html
>
> lynx <a at b.c> writes:
>
> > any good, simple work-even-remotely-alike for perl's CGI::Carp out there,
> > so i can send script errors to the browser and exit semi-gracefully?
> > any way to do such things in a general manner, for non-CGI stuff also?
>
> --
> Harry George
> hgg9140 at seanet.com

you should try this

#!/usr/bin/env python


try:
    put everything here
except:
    print "Content-type text/html\n"
    import sys
    sys.stderr = sys.stdout
    import traceback
    print "<pre>"
    traceback.print_exc()

What I use is a class called actionhandler.py, that alows you to pass form
field values as command line arguments. This lets you test your cgis or run
tham as normal scripts. I intent to put it public, but  .... documentaion!

thanos





More information about the Python-list mailing list