diff --git a/monai/data/dataset.py b/monai/data/dataset.py index 2c82bc27b3..eba850225d 100644 --- a/monai/data/dataset.py +++ b/monai/data/dataset.py @@ -389,7 +389,7 @@ def _cachecheck(self, item_transformed): raise e except RuntimeError as e: if "Invalid magic number; corrupt file" in str(e): - print(f"Corrupt cache file detected: {hashfile}. Deleting and recomputing.") + warnings.warn(f"Corrupt cache file detected: {hashfile}. Deleting and recomputing.") hashfile.unlink() else: raise e