![](/img/trans.png)
[英]How do I get the stack trace from an Exception Object in Python 2.7?
[英]How do I get the stack trace from an Exception Object in Python?
如何從Exception對象本身獲取完整的堆棧跟蹤?
考慮以下代碼作為問題的簡化示例:
last_exception = None
try:
raise Exception('foo failed')
except Exception as e:
last_exception = e
# this happens somewhere else, decoupled from the original raise
print_exception_stack_trace(last_exception)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.