手机
当前位置:查字典教程网 >脚本专栏 >python >Python RuntimeError: thread.__init__() not called解决方法
Python RuntimeError: thread.__init__() not called解决方法
摘要:在写一个多线程类的时候调用报错RuntimeError:thread.__init__()notcalled复制代码代码如下:classNo...

在写一个多线程类的时候调用报错

RuntimeError: thread.__init__() not called

复制代码 代码如下:

class NotifyTread(threading.Thread):

def __init__(self, params):

threading.Thread.__init__(self) #here。。。。。。

self.params = params

def run(self):

print "start notify............"

time.sleep(10)

print notify_tran(self.params)

print "end notify.............."

在init中要先初始化Thread,然后在给参数赋值,就能解决了。

也就是不能缺少

threading.Thread.__init__(self)

这是一个使用的注意地方。

【Python RuntimeError: thread.__init__() not called解决方法】相关文章:

pydev使用wxpython找不到路径的解决方法

Python httplib,smtplib使用方法

pip 错误unused-command-line-argument-hard-error-in-future解决办法

python脚本实现查找webshell的方法

python BeautifulSoup使用方法详解

Python urllib模块urlopen()与urlretrieve()详解

Python转码问题的解决方法

python pickle 和 shelve模块的用法

Python中的Function定义方法第1/2页

Python __getattr__与__setattr__使用方法

精品推荐
分类导航