我对multiprocessing.dummy
包和{
import deepdish as dd
from multiprocessing.dummy import Pool
def writeThings(args):
path, np_array = args
dd.io.save(path, {'arr': np_array}, compression='blosc')
p = Pool(4)
p.map(writeThings, all_np_arrays_and_paths)
当我把deepdish保存命令注释出来时,一切都很好。 似乎dd在Windows上创建了一种损坏的文件,Python检测到这个错误,就会崩溃。有人知道怎么解决这个问题吗?非常感谢你。在
为了澄清,路径是不同的,所以我写不同的文件。然而,这个简单的函数仍然不起作用。但是,如果我将其嵌入到一个
threading.Thread
类中,该类有一个锁,并用lock.acquire
包围dd.io.save
命令,并且在编写文件lock.release
之后,一切正常。在下面是每个人的代码片段:
相关问题 更多 >
编程相关推荐