Grab any exception in PyQt

浪子不回头ぞ 提交于 2019-12-05 15:44:41
ekhumoro

The point of using an excepthook is so you can monitor all exceptions that are raised by your program, and handle them centrally.

So you should get rid of most of those try/except blocks, and log the exceptions inside the excepthook function. I say "most", because you may be affected by bug 1230540, where sys.excepthook is not called correctly outside of the main thread. See the tracker thread for some workarounds for that, or this SO answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!