diff --git a/torchgeo/datasets/geo.py b/torchgeo/datasets/geo.py index aede7e6a405..18b3cd9310c 100644 --- a/torchgeo/datasets/geo.py +++ b/torchgeo/datasets/geo.py @@ -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 @@ -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