From b2396f109ffcf667b045b9a576f323eee95c2713 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: Wed, 7 Aug 2024 23:58:43 +0800 Subject: [PATCH] Update ankiconnect.py --- .../LunaTranslator/myutils/ankiconnect.py | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/LunaTranslator/LunaTranslator/myutils/ankiconnect.py b/LunaTranslator/LunaTranslator/myutils/ankiconnect.py index d1a012a8..30f63398 100644 --- a/LunaTranslator/LunaTranslator/myutils/ankiconnect.py +++ b/LunaTranslator/LunaTranslator/myutils/ankiconnect.py @@ -91,22 +91,14 @@ class Card: class Model: @staticmethod def create(modelName, inOrderFields: list, css, isCloze, cardTemplates): - try: - print( - invoke( - "createModel", - modelName=modelName, - inOrderFields=inOrderFields, - css=css, - isCloze=isCloze, - cardTemplates=cardTemplates, - ) - ) - except AnkiException as e: - if str(e) == "Model name already exists": - pass - else: - raise e + invoke( + "createModel", + modelName=modelName, + inOrderFields=inOrderFields, + css=css, + isCloze=isCloze, + cardTemplates=cardTemplates, + ) return Model(modelName) def __init__(self, name):