      image = None
      try:
          image = cv2.imread(filename)
          if image is None:
              raise ValueError
      except TypeError:
          success = False
          msg = "Error while reading image (TypeError): '{}'".format(filename)
          logger.error(msg)
          if raise_error:
              raise Exception(msg)
 
</s> remove         msg = ("Error while reading image. This is most likely caused by special characters in "
               "the filename: '{}'".format(filename))
 </s> add         msg = ("Error while reading image. This can be caused by special characters in the "
               "filename or a corrupt image file: '{}'".format(filename))
        msg += ". Original error message: {}".format(str(err)) </s> remove     except ValueError:
 </s> add     except ValueError as err:
            raise ValueError("Image is None")
    except TypeError as err:
      image = None
      try:
          image = cv2.imread(filename)
          if image is None:
            raise ValueError("Image is None")
    except TypeError as err:
            raise ValueError("Image is None")
    except TypeError as err:
          success = False
          msg = "Error while reading image (TypeError): '{}'".format(filename)
          logger.error(msg)
          if raise_error:
              raise Exception(msg)
keep keep keep keep replace replace keep keep keep keep keep
 lib.image - More information on image read errors 
lib/image.py