diff --git a/LunaTranslator/LunaTranslator/ocrengines/baseocrclass.py b/LunaTranslator/LunaTranslator/ocrengines/baseocrclass.py index 17a6d411..72ee8838 100644 --- a/LunaTranslator/LunaTranslator/ocrengines/baseocrclass.py +++ b/LunaTranslator/LunaTranslator/ocrengines/baseocrclass.py @@ -94,13 +94,21 @@ class baseocr(commonbase): ######################################################## def level2init(self): + self.needinit = True try: self.initocr() except Exception as e: raise e + self.needinit = False def _private_ocr(self, imgpath): - text = self.ocr(imgpath) + if self.needinit: + self.level2init() + try: + text = self.ocr(imgpath) + except Exception as e: + self.needinit = True + raise e return self._100_f(text) def _100_f(self, line):