[Tutor] Re: Translating to Python [perl --> python]

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 2 Jul 2002 01:16:11 -0700 (PDT)


On Mon, 1 Jul 2002, Kyle Babich wrote:

> How could I do this without cgitb?

Hi Kyle,

Which part, exactly, would you like to do without the 'cgitb' traceback
module?  cgitb modifies the programming environment slightly so that
raised exceptions give nicely formatted error messages back to the web
browser.


Try commenting the cgitb lines first, and deliberately introduce a syntax
error in the script --- you'll notice that the web server doesn't output
too much useful information back to the user (although it will be in the
error log).  On Apache, a bug in a CGI script brings up the infuriatingly
uninformative "Internal Server Error" page.


Afterwards, uncomment the cgitb-related lines and try again, and you'll
see a difference.  It's not mandatory, but it is pretty useful.  I usually
keep 'cgitb' on because it's such a nice debugging tool, and looks nicer
than having to do a:

    tail -f /var/log/apache/error.log

which would be an alternative way of watching script problems.


If you have more questions, please feel free to ask!  By the way, it
sounds like you're coming from a Perl background.  How much Perl do you
know already?  We can tailor our answers to take advantage of your
experiences in other languages, if that would be helpful for you.


Good luck!