为了账号安全,请及时绑定邮箱和手机立即绑定

python threading开启的线程中用multiprocessing再开启多线程出现AttributeError

python threading开启的线程中用multiprocessing再开启多线程出现AttributeError

HUX布斯 2019-04-08 11:18:41
一个简单的例子重现这个报错:frommultiprocessing.dummyimportPoolasThreadPoolimportthreadingdefwork():l=[1,2,3]pool=ThreadPool(3)pool.map(work2,l)pool.close()pool.join()if__name__=='__main__':t=threading.Thread(target=work)t.start()错误信息:ExceptioninthreadThread-1:Traceback(mostrecentcalllast):File"/usr/lib/python2.7/threading.py",line551,in__bootstrap_innerself.run()File"/usr/lib/python2.7/threading.py",line504,inrunself.__target(*self.__args,**self.__kwargs)File"/home/eggeek/palendar/geodata/operation/praser.py",line7,inworkpool=ThreadPool(3)File"/usr/lib/python2.7/multiprocessing/dummy/__init__.py",line150,inPoolreturnThreadPool(processes,initializer,initargs)File"/usr/lib/python2.7/multiprocessing/pool.py",line685,in__init__Pool.__init__(self,processes,initializer,initargs)File"/usr/lib/python2.7/multiprocessing/pool.py",line136,in__init__self._repopulate_pool()File"/usr/lib/python2.7/multiprocessing/pool.py",line199,in_repopulate_poolw.start()File"/usr/lib/python2.7/multiprocessing/dummy/__init__.py",line73,instartself._parent._children[self]=NoneAttributeError:'Thread'objecthasnoattribute'_children'
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 329 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信