无法将QVariant转换回Python对象

时间:2017-08-16 20:37:00

标签: python pyqt pyqt5

下面的发射信号线中的第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

如果我尝试任何其他组合:

PyQt_PyObject  
traceback: Optional[str]=None  
traceback: Optional[types.TracebackType]=None  

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

使用Qt5 5.7,PyQt5 5.7,Python3 3.5.1

0 个答案:

没有答案