From ea3c6cad4278de956beed9c8f871393fe0b3276c Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 25 Mar 2020 08:53:31 +1000 Subject: [PATCH] don't error when -l passes in language without _ --- pylib/anki/lang.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pylib/anki/lang.py b/pylib/anki/lang.py index e679b5d85..50bf528a7 100644 --- a/pylib/anki/lang.py +++ b/pylib/anki/lang.py @@ -133,7 +133,11 @@ def lang_to_disk_lang(lang: str) -> str: ): return lang.replace("_", "-") # other languages have the region portion stripped - return re.match("(.*)_", lang).group(1) + m = re.match("(.*)_", lang) + if m: + return m.group(1) + else: + return lang # the currently set interface language