Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

user managed error processing

user managed error processing

user managed error processing

I have inherited some Python code and I am not a Python programmer.  I am looking for a simple way to trap an error so I can gracefully manage the error.  Right now it just puts the error on the screen.  I think I need to use

import cgitb; cgitb.enable()

somehow, but I can not figure out how.  Any hints?

RE: user managed error processing

this works provided your Python code is a CGI script
I usually place this line at the start of the code
before any other imports, e.g.,


"""this is my CGI script
import cgitb; cgitb.enable()
import MySQLdb

# rest of code here

what the cgitb.enable() call does though is output a
formatted traceback to stdout
(which in the case of a CGI script is the client's browser)

RE: user managed error processing

Makes sense - so any idea how I stop it from going to the browser?  

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close