I cannot open my h5 file


I want to open my h5 file with this code:

file = h5py.File(fpath, "r")

But I get this error message:

OSError: Unable to open file (file signature not found)

It has worked before, but somehow now it doesn’t work anymore… (the path is correct, path.exists(fpath) also yields True)

Can you send us the output of h5dump -pBH <filename> or h5ls -r <filename>?
If you don’t have those tools, how about od -cN 8 <filename>?


With h5dump -pBH <fpath> I get zsh: parse error near\n’`, but opening works now, after I restarted my Jupyter Notebook…

Mmh, I have this error again now… any other ideas except restarting the whole kernel?

I just restarted the kernel. Then I couldn’t open it with “r”, only with “r+”…

Now I get this error message, when trying to open it with h5py.File(fpath,“r+”):

OSError: Unable to open file (file is already open for read-only)

And in my other project:

OSError: Unable to open file (unable to lock file, errno = 11, error message = 'Resource temporarily unavailable')

EDIT: So it appears that I have opened the file under different variable names. I have one function which just does one thing, and only once, so I use the with statement for that. I guess my issue is solved!