无法将QVariant转换回Python对象

2024-10-03 04:35:00 发布

您现在位置:Python中文网/ 问答频道 /正文

下面的emit signal line中的第3个参数有问题。如图所示,程序在标题中生成错误:

exception_caught = pyqtSignal(str, str, types.TracebackType)

def exception_handler(self, excepthook):
    """Handler for uncaught exceptions

    :param excepthook: Exception handle function
    :type excepthook: function
    """
    def wrapper(error_type, error_obj, traceback):
        """Wrapper to handle the exceptions

        :param error_type: Exception class
        :type error_type: type

        :param error_obj: Exception instance
        :type error_obj: Exception

        :param traceback: Traceback object
        :type traceback: TracebackType
        """
        sys.callstats()
        self.exception_caught.emit(str(error_obj), "error", traceback)
        excepthook(error_type, error_obj, traceback)

    return wrapper

如果我尝试其他组合:

^{pr2}$

然后,错误是参数3意外地是None。在

使用Qt5 5.7、PyQt5 5.7、Python3 3 3.5.1


Tags: obj参数paramdeftype错误exceptionerror