From 6ca089c36c4a1157f8d968505f41fbb5b5ef993e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 6 May 2021 17:00:11 +1000 Subject: [PATCH] don't throw an error when an invalid sort order is provided --- pylib/anki/collection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index dc62566b8..fcae9dc79 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -40,7 +40,7 @@ from anki.config import Config, ConfigManager from anki.consts import * from anki.dbproxy import DBProxy from anki.decks import Deck, DeckConfig, DeckConfigId, DeckId, DeckManager -from anki.errors import AbortSchemaModification, DBError, InvalidInput +from anki.errors import AbortSchemaModification, DBError from anki.lang import FormatTimeSpan from anki.media import MediaManager, media_paths_from_col_path from anki.models import ModelManager, Notetype, NotetypeDict, NotetypeId @@ -579,7 +579,10 @@ class Collection: return _pb.SortOrder( builtin=_pb.SortOrder.Builtin(column=order.key, reverse=reverse) ) - raise InvalidInput(f"{order} is not a valid sort order.") + + # eg, user is ordering on an add-on field with the add-on not installed + print(f"{order} is not a valid sort order.") + return _pb.SortOrder(none=_pb.Empty()) def find_and_replace( self,