print muted exception from multiprocessing pool
Yi Ge me@yige.ch
Sun, 15 Dec 2019 22:29:13 +0800
1 files changed,
6 insertions(+),
1 deletions(-)
jump to
M
videocr/video.py
→
videocr/video.py
@@ -1,4 +1,6 @@
from __future__ import annotations +from typing import List +import sys import multiprocessing import pytesseract import cv2@@ -55,7 +57,10 @@ if not self.use_fullframe:
# only use bottom half of the frame by default img = img[self.height // 2:, :] config = '--tessdata-dir "{}"'.format(constants.TESSDATA_DIR) - return pytesseract.image_to_data(img, lang=self.lang, config=config) + try: + return pytesseract.image_to_data(img, lang=self.lang, config=config) + except Exception as e: + sys.exit('{}: {}'.format(e.__class__.__name__, e)) def get_subtitles(self, sim_threshold: int) -> str: self._generate_subtitles(sim_threshold)