xxyzz / WordDumb

A calibre plugin that generates Kindle Word Wise and X-Ray files for KFX, AZW3, MOBI and EPUB eBook.
https://xxyzz.github.io/WordDumb/
GNU General Public License v3.0
364 stars 18 forks source link

Key error after updating to 3.32.1 #243

Closed wu-hongjun closed 1 month ago

wu-hongjun commented 1 month ago

Checkboxes

Describe the bug and copy the error message

It was working fine for 3.32.0, but when I updated to 3.32.1 using the Calibre's own plugin updater, it is giving me a key error:

calibre, version 7.13.0
ERROR: Unhandled exception: <b>KeyError</b>:'zh_cn'

calibre 7.13  embedded-python: True
macOS-14.5-arm64-arm-64bit Darwin ('64bit', '')
('Darwin', '23.5.0', 'Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000')
Python 3.11.5
OSX: ('14.5', ('', '', ''), 'arm64')
Interface language: None
EXE path: /Applications/calibre.app/Contents/MacOS/calibre
Successfully initialized third party plugins: WordDumb (3, 32, 1)
Traceback (most recent call last):
  File "calibre_plugins.worddumb.ui", line 103, in run
    for md_result in get_metadata_of_selected_books(gui, False):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.worddumb.ui", line 90, in get_metadata_of_selected_books
    [
  File "calibre_plugins.worddumb.ui", line 91, in <listcomp>
    check_metadata(gui, book_id, custom_x_ray)
  File "calibre_plugins.worddumb.metadata", line 62, in check_metadata
    book_lang in lang_dict[gloss_lang].get("lemma_languages", [])
                 ~~~~~~~~~^^^^^^^^^^^^
KeyError: 'zh_cn'

Plugin settings and reproduce steps

Plugin: 3.32.1 Calibre: 7.13.0

Generated files, screenshots or videos

No response

xxyzz commented 1 month ago

https://github.com/xxyzz/WordDumb/actions/runs/9855767665 should fix the error

wu-hongjun commented 1 month ago

I don't think this version was pushed to the main branch for Calibre to update? Thanks for the fix!

xxyzz commented 1 month ago

The commit was pushed to the master branch but not released yet.