def exception_data(func, *args, **kwds):
 try:
  func(*args, **kwds)
 except Exception as detail:
  return (detail, detail.args, ('%s: %s' % (detail.__class__.__name__, detail)))

def exception_data ( func , * args , ** kwds ) : try : func ( * args , ** kwds ) except Exception as detail : return ( detail , detail . args , ( '%s: %s' % ( detail . __class__ . __name__ , detail ) ) )
execute func and return the resulting exception .