Skip to content

numpy.load does not release file handle for npz files (Trac #1517) #2114

@thouis

Description

@thouis

Original ticket http://projects.scipy.org/numpy/ticket/1517 on 2010-06-22 by trac user etecman, assigned to unknown.

When opening a npz file with numpy.load, the handle to the file is not released such that the file cannot be deleted during the runtime of the script - even if all returned values are deleted.

Error message:

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'deleteme.npz'

Example:

import os
import numpy
a =  numpy.array([[1, 2, 3], [4, 5, 6]])
filenameNPZ = "deleteme.npz"
numpy.savez(filenameNPZ, a = a)
npz = numpy.load(filenameNPZ)
del npz
os.remove(filenameNPZ)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions