Skip to content

Commit

Permalink
bug fixes on my terrible code
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Dec 20, 2024
1 parent f025b63 commit bb83a9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rex/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,9 +1140,9 @@ def open_file(file_path, mode='r', hsds=False, hsds_kwargs=None):
file on s3 using h5py and fsspec, or the file on HSDS using h5pyd.
"""

if file_path.startswith('/hsds/') or hsds:
if file_path.startswith('/nrel/') or hsds:
if mode != 'r':
msg = 'Cannot write to files accessed vias HSDS!'
msg = 'Cannot write to files accessed via HSDS!'
logger.error(msg)
raise OSError(msg)

Expand All @@ -1160,11 +1160,12 @@ def open_file(file_path, mode='r', hsds=False, hsds_kwargs=None):
file = h5pyd.File(file_path, mode='r', use_cache=False,
**hsds_kwargs)

if file_path.startswith('s3://'):
elif file_path.startswith('s3://'):
if mode != 'r':
msg = 'Cannot write to files accessed vias HSDS!'
msg = 'Cannot write to files accessed via s3/fsspec!'
logger.error(msg)
raise OSError(msg)

try:
import fsspec
except Exception as e:
Expand Down

0 comments on commit bb83a9e

Please sign in to comment.