From a6a442c54eed72f805d0482c1da759a746357a95 Mon Sep 17 00:00:00 2001 From: ente Date: Mon, 13 Jun 2022 13:47:32 +0200 Subject: [PATCH] Added NoOption error handler for not mandatory options --- miceco.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/miceco.py b/miceco.py index 80f5acd..1ca4077 100755 --- a/miceco.py +++ b/miceco.py @@ -52,12 +52,12 @@ user = config.get("misskey", "user") try: getReactions = check_str_to_bool(config.get("misskey", "getReaction")) -except (TypeError, ValueError) as err: +except (TypeError, ValueError, configparser.NoOptionError) as err: getReactions = False try: ignoreEmojis = check_str_to_bool(config.get("misskey", "ignoreEmojis")) -except (TypeError, ValueError) as err: +except (TypeError, ValueError, configparser.NoOptionError) as err: ignoreEmojis = False if ignoreEmojis: @@ -77,9 +77,12 @@ if ignoreEmojis: i = element.strip() ignored_emojis.append(emojilib.demojize(i)) -noteVisibility = config.get("misskey", "noteVisibility") # How should the note be printed? -if noteVisibility != "public" and noteVisibility != "home" and noteVisibility != "followers" and noteVisibility != \ - "specified": +try: + noteVisibility = config.get("misskey", "noteVisibility") # How should the note be printed? + if noteVisibility != "public" and noteVisibility != "home" and noteVisibility != "followers" and noteVisibility != \ + "specified": + noteVisibility = "followers" +except configparser.NoOptionError as err: noteVisibility = "followers" try: @@ -200,7 +203,6 @@ for element in noteList: UTF8text = element["text"] UTF8ListRaw = emojilib.distinct_emoji_list(UTF8text) # Find all UTF8 Emojis in Text and CW text UTF8text = emojilib.demojize(UTF8text) - # TODO urgent! replace "get_emoji_regexp" if len(UTF8ListRaw) > 0: UTF8List = list(set(UTF8ListRaw)) for emoji in UTF8List: