From 464c3a4c76ebb9360eb4dd5f394179e6e5048fc8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 4 Oct 2023 15:11:13 +0530 Subject: [PATCH] Only use dictionaries path workaround for HTTP 404 errors --- src/calibre/spell/import_from.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/spell/import_from.py b/src/calibre/spell/import_from.py index 0d49687425..ff425461a2 100644 --- a/src/calibre/spell/import_from.py +++ b/src/calibre/spell/import_from.py @@ -163,7 +163,9 @@ def import_from_online(directory, name, dest_dir=None, prefix='dic-'): try: rp = br.open('/'.join((ONLINE_DICTIONARY_BASE_URL, directory, key))) return rp.read() - except: + except Exception as err: + if getattr(err, 'code', -1) != 404: + raise # Some dictionaries apparently put the dic and aff file in a # sub-directory dictionaries and incorrectly make paths relative # to that directory instead of the root, for example: