Python RuntimeError: thread.__init__() not called解决方法
2015-04-28 09:12
1266 查看
在写一个多线程类的时候调用报错
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中的__init__()方法
- python中的__init__ 、__new__、__call__小结
- 详解Python中的__init__和__new__
- Python类方法__init__和__del__构造、析构过程分析
- Python中__init__.py文件的作用详解
- 详解Python中的__new__、__init__、__call__三个特殊方法
- Python中__init__和__new__的区别详解
- Python中的__new__与__init__魔术方法理解笔记
- Python中__new__与__init__方法的区别详解
- python中子类继承父类的__init__方法实例
相关文章推荐
- Python RuntimeError: thread.__init__() not called
- java.lang.InternalError: Thread starting during runtime shutdown
- 【python3】 django2.0 在生成数据库表时报错: TypeError: __init__() missing 1 required positional argument: 'on_delete'
- python3.5 + PyQt4 + pyinstaller打包错误,Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
- Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, do
- Python multi thread "error: longjmp causes uninitialized stack frame"
- paddle paddle 运行 Fatal Python error: PyThreadState_Get: no current thread
- GemFI安装中的'Error: can't find library -lpthread required by python'
- python将数据写入excel文件时报错ew = ExcelWriter(workbook=wb) TypeError: __init__() takes exactly 3 arguments
- Python多线程报错之RuntimeError
- C++开发python扩展模块:ImportError: dynamic module does not define init function (initRabbit)解决办法
- python RuntimeError: maximum recursion depth exceeded
- Python openpyxl TypeError: __init__() got an unexpected keyword argument 'pivotButton' (and)
- Python报错: Unhandled exception in thread started by Error in sys.excepthook
- deepwalk遇到RuntimeError on windows trying python multiprocessing问题解决办法
- python识别图片使用pytesser模块时__init__.py调用subprocess模块出现WindowsError: [Error 2]
- 启动Ambari报错: ERROR [ambari-client-thread-34] ContainerResponse:419 - The RuntimeException could not b
- NLPIR RuntimeError: NLPIR function 'NLPIR_Init' failed 解决方案
- python TypeError: can't pickle _thread.RLock objects
- NLPIR RuntimeError: NLPIR function 'NLPIR_Init' failed 解决方案