Suppressing rhdf5 error messages
Entering edit mode
Mike Smith ★ 5.5k
Last seen 5 hours ago
EMBL Heidelberg / de.NBI

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
    minor: Read failed
  #002: H5Fsuper.c line 351 in H5F_super_read(): unable to load superblock
    major: Object cache
    minor: Unable to protect metadata
  #003: H5AC.c line 1322 in H5AC_protect(): H5C_protect() failed.
    major: Object cache
    minor: Unable to protect metadata
  #004: H5C.c line 3567 in H5C_protect(): can't load entry
    major: Object cache
    minor: Unable to load metadata into cache
  #005: H5C.c line 7957 in H5C_load_entry(): unable to load entry
    major: Object cache
    minor: Unable to load metadata into 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:




rhdf5 hdf5 • 1.3k views
Entering edit mode
Bernd Fischer ▴ 550
Last seen 5.4 years ago
Germany / Heidelberg / DKFZ

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.



Entering edit mode

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.


Login before adding your answer.

Traffic: 481 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6