I have a traceback object that I want to show in the nice format I get when calling traceback.format_exc().
Is there a builtin function for this? Or a few lines of code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
format_exc()is really justSo if you have the exception type, value, and traceback ready, it should be easy. If you have just the exception, notice that
format_exception()is essentially:where
limitdefaults toNone.