Feature Requests item #1553375, was opened at 2006-09-06 12:48 Message generated for change (Comment added) made by hoffmanm You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1553375&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.6 Status: Open Resolution: None Priority: 5 Submitted By: Michael Hoffman (hoffmanm) Assigned to: Nobody/Anonymous (nobody) Summary: Add traceback.print_full_exception() Initial Comment: The suggestion is to add something roughly like this: def print_full_exception(type, value, traceback, file): . _print(sys.stderr, 'Traceback (most recent call last):') . print_stack(traceback.tb_frame.f_back, file=file) . print_tb(traceback, file=file) . . lines = format_exception_only(type, value) . for line in lines[:-1]: . _print(file, line, ' ') . _print(file, lines[-1], '') to the traceback module, to print the exception not just downward from the calling point, but also upward all the way to the top of the stack. This would be useful in, e.g. logging, where exceptions are caught and printed, but right now no information is given as to where they occurred in user code. ---------------------------------------------------------------------- >Comment By: Michael Hoffman (hoffmanm) Date: 2006-09-06 13:04 Message: Logged In: YES user_id=987664 Here's some test code that might indicate how this is useful: def x(n=0): .....try: ..........y(n+1) .....except: ..........ei = sys.exc_info() ..........print_full_exception(ei[0], ei[1], ei[2], sys.stderr) def y(n): .....if n > 10: ..........raise IOError, "test" ..... .....x(n+1) x() ---------------------------------------------------------------------- Comment By: Michael Hoffman (hoffmanm) Date: 2006-09-06 12:59 Message: Logged In: YES user_id=987664 Hmmm, my indentation didn't work very well. Hopefully you should be able to figure it out though. :) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1553375&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com