Domanda

import h5py #added
hf = h5py.File('../images.h5', 'w') #added
hf.close() #added

h5_file = tables.open_file("images.h5", mode="w")

Ho anche provato:

h5py.File.close(hf)

L'errore che si presenta in entrambi i casi è:

ValueError: The file 'restricted_images.h5' is already opened.  Please close it before reopening in write mode.

Ho anche provato:

if isinstance(obj, h5py.File):   # Just HDF5 files
    obj.close()

mentre

In[]: hf
Out[]: <Closed HDF5 file> 

, il file non è ancora chiuso.

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
scroll top