469,306 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Showing errors explicitly in try... except

When using try... except... errors don't show up. Is there a way to
force stderr despite using try...except?

thanks,

Harlin Seritt

Jul 18 '05 #1
2 1169

"Harlin Seritt" <ha**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
When using try... except... errors don't show up. Is there a way to
force stderr despite using try...except?
If you're looking for stack traces, look at the inspect and
traceback modules. They contain the tools to do just
about anything you need for error reporting. Also there
is a logger module somewhere so you can put the stuff
somewhere permanent if you want.

John Roth

thanks,

Harlin Seritt


Jul 18 '05 #2
Harlin Seritt wrote:
When using try... except... errors don't show up. Is there a way to
force stderr despite using try...except?


"force", no. The "stderr" stuff is done by an "unhandled
exception" handler that is at the very top level, so
if you catch the exception, it will never see it to
print it.

Doing this will probably suffice, however:

import traceback
try:
1/0

# one should avoid non-specific exception catching
# in most cases, but this is an example:
except:
traceback.print_exc()
-Peter
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Isaac Councill | last post: by
reply views Thread by Dimitre Novatchev | last post: by
12 posts views Thread by Russ | last post: by
14 posts views Thread by beginner10 | last post: by
1 post views Thread by Hari Sekhon | last post: by
16 posts views Thread by Niels L Ellegaard | last post: by
10 posts views Thread by Thomas Guettler | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.