当线程中发生异常时,我得到的不是包含异常行号的完整异常信息,而是:
Unhandled exception in thread started by <function get_artist at 0x0000000002C2FEB8>
我可以手动编写 try、catch 过程来打印出有关异常的缺失信息吗?
我试过:
except Exception:
traceback.print_exc()
但是,它仍然只打印上面的消息。
请您参考如下方法:
您是否尝试过使用 as 获取异常?像这样的……
try:
raise Exception('MONSTER!')
except Exception as ex:
print 'The error is a %s' % ex
>>> The error is a MONSTER!
