Process finished with exit code -1073741819 (0xC0000005)
Process finished with exit code -1073741819 (0xC0000005)
在主界面初始化时调用:Qthread
thread = Mythread()
thread.start()
结果报错了
Qthread不能是临时变量,因为线程需要持续执行,临时变量会马上销毁,
解决方法:
self.thread = Mythread()
self.thread.start()
Mythread代码:
class Mythread(QThread):
# 定义信号,定义参数为str类型
def __init__(self, parent=None):
super().__init__(parent)
# super(Mythread, self).__init__()
def callb_error(self, err_type, cam_no, msg_no, msg_level, msg_txt, msg_txtlen):
print(“myerror”, err_type, cam_no, msg_no, msg_level, msg_txt, msg_txtlen)
def run(self):
file_name=”d:/201805070000.dat”
self.filename = bytes(file_name, encoding=”utf8″)
begin = datetime.datetime.now()
print(1111)
转载自:https://blog.csdn.net/jacke121/article/details/80517295