diff --git a/helpers/images.py b/helpers/images.py index 216f11f4..96c28392 100644 --- a/helpers/images.py +++ b/helpers/images.py @@ -191,7 +191,8 @@ def get_image_hash(img, hash_type="blake3", direct_pixel_data=True) -> (str, boo is_dicom = True # ---- - except pydicom.errors.InvalidDicomError as e: + # Random error catching is bad + except (pydicom.errors.InvalidDicomError, TypeError) as e: print("dicom error", img) try: # This is horrible (but needed for current unit tests) # (we use a temporary file that breaks here) @@ -202,6 +203,7 @@ def get_image_hash(img, hash_type="blake3", direct_pixel_data=True) -> (str, boo case "blake3": hash = blake3(img.read()).hexdigest() except AttributeError: + print("BAD") return hash, False return hash, is_dicom \ No newline at end of file