Skip to content

Commit

Permalink
GeoDataset: better error message when no data found (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart authored and calebrob6 committed Apr 10, 2023
1 parent 4cb49f8 commit 4dfbcd5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions torchgeo/datasets/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,10 @@ def __init__(
i += 1

if i == 0:
raise FileNotFoundError(
f"No {self.__class__.__name__} data was found in '{root}'"
)
msg = f"No {self.__class__.__name__} data was found in `root='{self.root}'`"
if self.bands:
msg += f" with `bands={self.bands}`"
raise FileNotFoundError(msg)

if not self.separate_files:
self.band_indexes = None
Expand Down Expand Up @@ -582,9 +583,8 @@ def __init__(
i += 1

if i == 0:
raise FileNotFoundError(
f"No {self.__class__.__name__} data was found in '{root}'"
)
msg = f"No {self.__class__.__name__} data was found in `root='{root}'`"
raise FileNotFoundError(msg)

self._crs = crs

Expand Down

0 comments on commit 4dfbcd5

Please sign in to comment.