#NEWLINE# def formatOutput( e ) : #NEWLINE# #INDENT# if ( len ( e . args ) > 1 ) : #NEWLINE# #INDENT# ( reason , ( filename , lineno , colno , message ) ) = e . args #NEWLINE# if ( ( message is None ) and ( colno is not None ) ) : #NEWLINE# #INDENT# colno = None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( reason , ) = e . args #NEWLINE# filename = None #NEWLINE# lineno = None #NEWLINE# colno = None #NEWLINE# message = None #NEWLINE# #UNINDENT# if hasattr ( e , 'msg' ) : #NEWLINE# #INDENT# reason = e . msg #NEWLINE# #UNINDENT# if ( colno is not None ) : #NEWLINE# #INDENT# colno = ( ( colno - len ( message ) ) + len ( message . lstrip ( ) ) ) #NEWLINE# return ( '  File "%s", line %d\n    %s\n    %s^\n%s: %s' % ( filename , lineno , message . strip ( ) , ( ( ' ' * ( colno - 1 ) ) if ( colno is not None ) else '' ) , e . __class__ . __name__ , reason ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( message is not None ) : #NEWLINE# #INDENT# return ( '  File "%s", line %d\n    %s\n%s: %s' % ( filename , lineno , message . strip ( ) , e . __class__ . __name__ , reason ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( filename is not None ) : #NEWLINE# #INDENT# return ( '  File "%s", line %s\n%s: %s' % ( filename , lineno , e . __class__ . __name__ , reason ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( '%s: %s' % ( e . __class__ . __name__ , reason ) )