Skip to content

Commit

Permalink
Make try-catch more targeted
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantre committed Jun 23, 2023
1 parent f0d9475 commit 7ca3cb7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions torchgeo/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,9 @@ def _listdir_vsi_recursive(root: str) -> list[str]:
try:
subdirs = fiona.listdir(dir)
dirs.extend([os.path.join(dir, subdir) for subdir in subdirs])
except FionaValueError:
files.append(dir)
except FionaValueError as e:
if "is not a directory" in str(e):
files.append(dir)
return files


Expand Down

0 comments on commit 7ca3cb7

Please sign in to comment.