【发布时间】:2016-10-10 07:47:10
【问题描述】:
我无法删除 numpy.memmap 函数创建的文件
class MyClass
def __init__(self):
self.fp = np.memmap(filename, dtype='float32', mode='w+', shape=flushed_chunk_shape)
...
def __del__(self):
del self.fp
os.remove(filename)
当我运行del myclass(MyClass 的实例)时,出现错误WindowsError: [Error 32] The process cannot access the file。如果我使用memmap 并以不面向对象的方式删除文件,一切正常。所以我认为析构函数有问题。但为什么会这样呢?
【问题讨论】:
标签: python numpy numpy-memmap