Skip to content

Accept file handle

Vincent POLLET requested to merge accept_file_handle into master

Allow StreamFile class to accept a file handle of the hdf5 file, and use bob.io.base.HDF5File only if a path is provided.

Advantage:

  • Allows to use bob.io.stream with different back-end for interacting with hdf5 library.

Drawback:

  • Less clear who is in charge of opening and closing the file: in the case a string is received, StreamFile handles opening and closing - in the case a file handle is given, the owner of the file must take care of it.
  • If someone provides a file handle which doesn't have a "lread" function, reading will fail and the error won't be very helpful. Concretely, it would be good to list the "back-end" that will work ?
Edited by Vincent POLLET

Merge request reports