Search
Question: Suppressing rhdf5 error messages
0
3.3 years ago by
Mike Smith2.9k
EMBL Heidelberg / de.NBI
Mike Smith2.9k wrote:

I'm using rhdf5 to read a large number of hdf5 files.  Occasionally I encounter a file that may be corrupt or otherwise damaged, and rhdf5 (or anything else) is unable to open it.  This results in a large spew of error messages to the screen.

HDF5-DIAG: Error detected in HDF5 (1.8.7) thread 0:
#000: H5F.c line 1522 in H5Fopen(): unable to open file
major: File accessability
minor: Unable to open file
#001: H5F.c line 1313 in H5F_open(): unable to read superblock
major: File accessability
major: Object cache
#003: H5AC.c line 1322 in H5AC_protect(): H5C_protect() failed.
major: Object cache
#004: H5C.c line 3567 in H5C_protect(): can't load entry
major: Object cache
major: Object cache
#006: H5Fsuper_cache.c line 471 in H5F_sblock_load(): truncated file
major: File accessability
minor: File has been truncated
HDF5: unable to open file

I've written a function to catch these files before I try to do anything else with them by looking at the result of H5Fopen(), but the error messages are still printed to screen.  Is there some way to suppress them?

If it's of any help you can get examples of good and bad hdf5 files from here:

https://dl.dropboxusercontent.com/u/16340004/good.h5

Thanks,

Mike

modified 3.3 years ago by Bernd Fischer540 • written 3.3 years ago by Mike Smith2.9k
2
3.3 years ago by
Bernd Fischer540
Germany / Heidelberg / DKFZ
Bernd Fischer540 wrote:

Dear Mike,

I improved the error handling. HDF5 error messages are now forwarded to R and displayed with the R error messaging system. Furthermore, I added a function h5errorHandling(type="normal") that changes the verbosity of HDF5 error messages. With h5errorHandling(type="suppress") you will completely avoid error messages from HDF5 with h5errorHandling(type="verbose") you will get the complete error stack. Alternatively, you can use the R-style way of suppressing error messages:

options(show.error.messages = FALSE)

The mentioned changes will be available as rhdf5 version 2.13.2 in the devel version of bioconductor from tomorrow evening on.

Bernd

Thanks very much Bernd.  I was hoping to be able to use suppressErrors() or the like, so this sounds exactly what I was hoping for.