I can’t get this to work by specifying only the aws_region
keyword (in addition to the driver).
This works:
>>> url = "https://...h5" # Pointing to an S3 object
>>> h5f = h5py.File(url, driver="ros3")
>>> h5f
<HDF5 file "...h5" (mode r)>
but this fails:
>>> h5f = h5py.File(url, driver="ros3", aws_region="us-west-2".encode("utf-8"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/gedi_subset/lib/python3.10/site-packages/h5py/_hl/files.py", line 502, in __init__
fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0,
File "/opt/conda/envs/gedi_subset/lib/python3.10/site-packages/h5py/_hl/files.py", line 166, in make_fapl
set_fapl(plist, **kwds)
File "/opt/conda/envs/gedi_subset/lib/python3.10/site-packages/h5py/_hl/files.py", line 78, in <lambda>
_drivers['ros3'] = lambda plist, **kwargs: plist.set_fapl_ros3(**kwargs)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5p.pyx", line 1072, in h5py.h5p.PropFAID.set_fapl_ros3
ValueError: Invalid ros3 config (Inconsistent authentication information)
Should the aws_region
be specified only when I also need to supply access_id
and access_key
as well? In other words, is aws_region
not allowed for unauthenticated access?
I might suspect that aws_region
is unnecessary when using the https url, so I tried using the corresponding s3://
url instead, and that bombed with the same error as above.
Further, when I used the s3://
url without specifying aws_region
, I got the following error instead:
>>> h5 = h5py.File("s3://...h5", driver="ros3")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/gedi_subset/lib/python3.10/site-packages/h5py/_hl/files.py", line 507, in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
File "/opt/conda/envs/gedi_subset/lib/python3.10/site-packages/h5py/_hl/files.py", line 220, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 106, in h5py.h5f.open
OSError: Unable to open file (invalid SCHEME construction)
Unfortunately, the official docs are not particularly informative regarding such details, so I’m having a hard time unraveling this mystery.