ERROR: Failed to open HDF5 file with mode 'w': summary.h5

Hi @TOWHID,

I just wanted to note that the openmc.StatePoint object has a close method that will allow you to release the HDF5 filehandle of both the statepoint.*.h5 file and the summary.h5 file if it is linked.

For others running into this problem and coming across this thread, here’s a link to the troubleshooting section in the docs on this issue.

https://docs.openmc.org/en/stable/usersguide/troubleshoot.html#runtimeerror-failed-to-open-hdf5-file-with-mode-w-summary-h5

This section notes that a more elegant way to manage the statepoint file handle is to retrieve data from the file within a context manager:

with openmc.StatePoint('statepoint.10.h5') as sp:
    k_eff = sp.keff

when the interpreter exits this block, the object will be automatically cleaned up and the HDF5 file handle will be released.

Either approach works, just wanted to let you know about both!

-Patrick

5 Likes