#NEWLINE# def print_exception( etype , value , tb , limit = None , file = None ) : #NEWLINE# #INDENT# 'Print exception up to \'limit\' stack trace entries from \'tb\' to \'file\'.\n\n    This differs from print_tb() in the following ways: (1) if\n    traceback is not None, it prints a header "Traceback (most recent\n    call last):"; (2) it prints the exception type and value after the\n    stack trace; (3) if type is SyntaxError and value has the\n    appropriate format, it prints the line where the syntax error\n    occurred with a caret on the next line indicating the approximate\n    position of the error.\n    ' #NEWLINE# if ( file is None ) : #NEWLINE# #INDENT# file = sys . stderr #NEWLINE# #UNINDENT# if tb : #NEWLINE# #INDENT# _print ( file , 'Traceback (most recent call last):' ) #NEWLINE# print_tb ( tb , limit , file ) #NEWLINE# #UNINDENT# lines = format_exception_only ( etype , value ) #NEWLINE# for line in lines [ : ( - 1 ) ] : #NEWLINE# #INDENT# _print ( file , line , ' ' ) #NEWLINE# #UNINDENT# _print ( file , lines [ ( - 1 ) ] , '' )