                  frame_no = os.path.splitext(filename)[0][filename.rfind("_") + 1:]
                  logger.trace("Extracted frame_no %s from filename '%s'", frame_no, filename)
              retval = self.load_one_video_frame(int(frame_no))
          else:
              retval = cv2.imread(filename)  # pylint: disable=no-member
          return retval
  
      def load_one_video_frame(self, frame_no):
          """ Load a single frame from a video file """
          logger.trace("Loading video frame: %s", frame_no)
 
</s> remove             image = cv2.imread(src)  # pylint: disable=no-member
 </s> add             image = cv2_read_img(src, raise_error=True) </s> remove             logger.trace("Loading image: '%s'", filename)
            try:
                image = cv2.imread(filename)  # pylint: disable=no-member
            except Exception as err:  # pylint: disable=broad-except
                logger.error("Failed to load image '%s'. Original Error: %s", filename, err)
 </s> add             image = cv2_read_img(filename, raise_error=False)
            if image is None: </s> remove         image = cv2.imread(filename)
 </s> add         image = cv2_read_img(filename, raise_error=True) </s> remove             retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
 </s> add             retval[fpath] = {"image": cv2_read_img(fpath, raise_error=True),
 </s> remove             retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
 </s> add             retval[fpath] = {"image": cv2_read_img(fpath, raise_error=True),

            retval = cv2_read_img(filename, raise_error=True)
                  frame_no = os.path.splitext(filename)[0][filename.rfind("_") + 1:]
                  logger.trace("Extracted frame_no %s from filename '%s'", frame_no, filename)
              retval = self.load_one_video_frame(int(frame_no))
          else:
            retval = cv2_read_img(filename, raise_error=True)
          return retval
  
      def load_one_video_frame(self, frame_no):
          """ Load a single frame from a video file """
          logger.trace("Loading video frame: %s", frame_no)
keep keep keep keep replace keep keep keep keep keep
 Centralize cv2 image reading and handle bad filenames 
scripts/fsmedia.py