欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python RuntimeError: thread.__init__() not called解決方法

 更新時間:2015年04月28日 09:12:38   投稿:junjie  
這篇文章主要介紹了Python RuntimeError: thread.__init__() not called解決方法,需要的朋友可以參考下

在寫一個多線程類的時候調(diào)用報錯
RuntimeError: thread.__init__() not called

復(fù)制代碼 代碼如下:

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,然后在給參數(shù)賦值,就能解決了。
也就是不能缺少
threading.Thread.__init__(self)
這是一個使用的注意地方。

相關(guān)文章

最新評論