假设我有以下 3 个脚本:
script1.py
script2.py
script3.py
可以说我得到这样的回溯:
Traceback (most recent call last):
File "script1.py", line xyz, in ...
...
File "script2.py", line xyz, in ...
...
File "script3.py", line xyz, in ...
...
AttributeError: 'NoneType' object has no attribute 'CoolAttribute'
我在 script3.py 中有几个不同的异常。有没有办法处理 script1.py 中 xyz 行中的任何这些异常,而不处理 script2.py 中的异常?我只想在 script1.py 中的一行中处理源自 script3.py 的异常。