catch more specific errors

This commit is contained in:
Xintao
2021-11-24 00:14:05 +08:00
parent 35ee6f781e
commit 7dd860a881
4 changed files with 4 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ def main(args):
# read the image once for check, as some images may have errors
try:
img = cv2.imread(img_path)
except Exception as error:
except (IOError, OSError) as error:
print(f'Read {img_path} error: {error}')
status = False
if img is None: