Skip to content

Commit

Permalink
fix for s3 hsload with h5image
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Aug 23, 2024
1 parent b01e9c6 commit e30b9aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion h5pyd/_apps/hsload.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ def main():

s3 = s3fs.S3FileSystem(**kwargs)
try:
fin = h5py.File(s3.open(src_file, "rb"), moe="r")
fs = s3.open(src_file, "rb") # get s3 file handle
if cfg["h5image"]:
fin = fs # just use the fs handle
else:
fin = h5py.File(fs) # return h5py file handle
except IOError as ioe:
abort(f"Error opening file {src_file}: {ioe}")

Expand Down

0 comments on commit e30b9aa

Please sign in to comment.