我从 Sacred's 的代码中得到下面给出的错误utils.py
,如果有任何解决方案,请告诉我。
AttributeError: 'TracebackException' object has no attribute 'exc_trackback'
exc_type, exc_value, exc_traceback = sys.exc_info()
# determine if last exception is from sacred
current_tb = exc_traceback
while current_tb.tb_next is not None:
current_tb = current_tb.tb_next
if filter_traceback == "default" and _is_sacred_frame(current_tb.tb_frame):
# just print sacred internal trace
header = [
"Exception originated from within Sacred.\n"
"Traceback (most recent calls):\n"
]
texts = tb.format_exception(exc_type, exc_value, current_tb)
return "".join(header + texts[1:]).strip()
elif filter_traceback in ("default", "always"):
# print filtered stacktrace
if sys.version_info >= (3, 5):
tb_exception = tb.TracebackException(
exc_type, exc_value, exc_traceback, limit=None
)
return "".join(filtered_traceback_format(tb_exception))
else:
s = "Traceback (most recent calls WITHOUT Sacred internals):"
current_tb = exc_traceback
while current_tb is not None:
if not _is_sacred_frame(current_tb.tb_frame):
tb.print_tb(current_tb, 1)
current_tb = current_tb.tb_next
s += "\n".join(tb.format_exception_only(exc_type, exc_value)).strip()
return s
elif filter_traceback == "never":
# print full stacktrace
return "\n".join(tb.format_exception(exc_type, exc_value, exc_traceback))
else:
raise ValueError("Unknown value for filter_traceback: " + filter_traceback)
错误信息:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "src/main.py", line 102, in <module>
ex.run_commandline(params)
File "C:\Users\XXXX\AppData\Local\Continuum\anaconda3\envs\marl38\lib\site-packages\sacred\experiment.py", line 347, in run_commandline
print_filtered_stacktrace()
File "C:\Users\XXXX\AppData\Local\Continuum\anaconda3\envs\marl38\lib\site-packages\sacred\utils.py", line 493, in print_filtered_stacktrace
print(format_filtered_stacktrace(filter_traceback), file=sys.stderr)
File "C:\Users\XXXX\AppData\Local\Continuum\anaconda3\envs\marl38\lib\site-packages\sacred\utils.py", line 528, in format_filtered_stacktrace
return "".join(filtered_traceback_format(tb_exception))
File "C:\Users\XXXX\AppData\Local\Continuum\anaconda3\envs\marl38\lib\site-packages\sacred\utils.py", line 568, in filtered_traceback_format
current_tb = tb_exception.exc_traceback
AttributeError: 'TracebackException' object has no attribute 'exc_traceback'