From 1bbf1cca472e4cba25c8d58c95c45ae3e251282c Mon Sep 17 00:00:00 2001 From: Shuo Zhong Date: Mon, 12 Feb 2024 10:49:48 -0500 Subject: [PATCH] log corrupted image file name in imread --- opensfm/io.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opensfm/io.py b/opensfm/io.py index d529a49d2..59c661f1a 100644 --- a/opensfm/io.py +++ b/opensfm/io.py @@ -1206,8 +1206,11 @@ def imread( if ext.lower() == ".tiff" or ext.lower() == ".tif": return imread_rasterio(path, grayscale, unchanged, anydepth) else: - with open(path, "rb") as fb: - return imread_from_fileobject(fb, grayscale, unchanged, anydepth) + try: + with open(path, "rb") as fb: + return imread_from_fileobject(fb, grayscale, unchanged, anydepth) + except IOError: + raise IOError("Unable to load image {}".format(path)) def imread_from_fileobject(