From 98b89cd43fa5f5ac7be69d0d5a8037103b3e51ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:24:45 +0800 Subject: [PATCH] . --- LunaTranslator/LunaTranslator/hiraparse/basehira.py | 6 ++++++ LunaTranslator/LunaTranslator/hiraparse/mecab.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/LunaTranslator/LunaTranslator/hiraparse/basehira.py b/LunaTranslator/LunaTranslator/hiraparse/basehira.py index cce21626..9a501019 100644 --- a/LunaTranslator/LunaTranslator/hiraparse/basehira.py +++ b/LunaTranslator/LunaTranslator/hiraparse/basehira.py @@ -3,6 +3,10 @@ from traceback import print_exc from myutils.proxy import getproxy +class KnownException(Exception): + pass + + class basehira: def init(self): pass @@ -86,6 +90,8 @@ class basehira: hira[_]["hira"] = hira[_]["hira"].replace( _ka[_reverse_idx], target[_reverse_idx] ) + except KnownException: + pass except: print_exc() return hira diff --git a/LunaTranslator/LunaTranslator/hiraparse/mecab.py b/LunaTranslator/LunaTranslator/hiraparse/mecab.py index 072a192c..fa5627d1 100644 --- a/LunaTranslator/LunaTranslator/hiraparse/mecab.py +++ b/LunaTranslator/LunaTranslator/hiraparse/mecab.py @@ -2,7 +2,7 @@ import winsharedutils import os, functools, csv, gobject from ctypes import CFUNCTYPE, c_char_p -from hiraparse.basehira import basehira +from hiraparse.basehira import basehira, KnownException # # 2.1.2 src schema # UnidicFeatures17 = namedtuple('UnidicFeatures17', @@ -65,7 +65,7 @@ class mecabwrap: fp = CFUNCTYPE(None, c_char_p, c_char_p)(cb) succ = winsharedutils.mecab_parse(self.kks, text.encode(codec), fp) if not succ: - raise Exception # failed + raise KnownException # failed return res