utils.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:MDT 作者: cbclab 项目源码 文件源码
def enable_pyqt_exception_hook():
    """Enable the PyQt exception handling hook for PyQt versions larger than 5.5.

    If this is not enabled, exceptions will be handled silently and will not be printed to the user. This
    makes it harder to solve the issue.
    """
    if QtCore.QT_VERSION >= 0x50501:
        old_stdout = sys.stdout
        old_stderr = sys.stderr

        def excepthook(type_, value, traceback_):
            sys.stdout = old_stdout
            sys.stderr = old_stderr
            traceback.print_exception(type_, value, traceback_)
            QtCore.qFatal('')
        sys.excepthook = excepthook
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号