Skip to content

Commit

Permalink
Fix reading HDF5 from buffer objects
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Nov 11, 2018
1 parent d8a5ea6 commit 1e905ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion thunor/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,11 +926,14 @@ def _read_hdf_unstacked(filename_or_buffer):
if isinstance(filename_or_buffer, str):
hdf_kwargs['path'] = filename_or_buffer
else:
if hasattr(filename_or_buffer, 'read') and \
callable(filename_or_buffer.read):
filename_or_buffer = filename_or_buffer.read()
hdf_kwargs.update({
'path': 'data.h5',
'driver': 'H5FD_CORE',
'driver_core_backing_store': 0,
'driver_core_image': filename_or_buffer.read()
'driver_core_image': filename_or_buffer
})
with pd.HDFStore(**hdf_kwargs) as hdf:
df_assays = hdf['assays']
Expand Down

0 comments on commit 1e905ac

Please sign in to comment.