Only use dictionaries path workaround for HTTP 404 errors

This commit is contained in:
Kovid Goyal 2023-10-04 15:11:13 +05:30
parent 0979c1a25c
commit 464c3a4c76
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -163,7 +163,9 @@ def import_from_online(directory, name, dest_dir=None, prefix='dic-'):
try: try:
rp = br.open('/'.join((ONLINE_DICTIONARY_BASE_URL, directory, key))) rp = br.open('/'.join((ONLINE_DICTIONARY_BASE_URL, directory, key)))
return rp.read() 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 # Some dictionaries apparently put the dic and aff file in a
# sub-directory dictionaries and incorrectly make paths relative # sub-directory dictionaries and incorrectly make paths relative
# to that directory instead of the root, for example: # to that directory instead of the root, for example: