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

一个简单的例子重现这个报错:

from multiprocessing.dummy import Pool as ThreadPool

import threading

def work():

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()

错误信息:

Exception in thread Thread-1:

Traceback (most recent call last):

File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner

self.run()

File "/usr/lib/python2.7/threading.py", line 504, in run

self.__target(*self.__args, **self.__kwargs)

File "/home/eggeek/palendar/geodata/operation/praser.py", line 7, in work

pool = ThreadPool(3)

File "/usr/lib/python2.7/multiprocessing/dummy/__init__.py", line 150, in Pool

return ThreadPool(processes, initializer, initargs)

File "/usr/lib/python2.7/multiprocessing/pool.py", line 685, in __init__

Pool.__init__(self, processes, initializer, initargs)

File "/usr/lib/python2.7/multiprocessing/pool.py", line 136, in __init__

self._repopulate_pool()

File "/usr/lib/python2.7/multiprocessing/pool.py", line 199, in _repopulate_pool

w.start()

File "/usr/lib/python2.7/multiprocessing/dummy/__init__.py", line 73, in start

self._parent._children[self] = None

AttributeError: 'Thread' object has no attribute '_children'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值