[英]Debugging in a context manager in python
I have quite a complex context manager integrated into my software and I am making some changes to them. 我的软件中集成了一个非常复杂的上下文管理器,并且正在对其进行一些更改。 How can I get a full error log that occurs within the with the block.
我如何获得完整的错误日志,该错误日志在块内出现。 All I can do so far is:
到目前为止,我所能做的就是:
print exc_type
print exc_val
print exc_tb
But this does not reveal the full traceback of the error. 但这并不能揭示错误的完整追溯。 How can I get the classic error log à la
Traceback (most recent call last):
我如何获得经典的错误日志“
Traceback (most recent call last):
Thank you for any help 感谢您的任何帮助
You can 您可以
import traceback
and then 接着
traceback.print_exc()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.