artyompetrov / AutoDefine_oxfordlearnersdictionaries

An add-on to Anki that auto-defines words and images.
GNU General Public License v2.0
17 stars 10 forks source link

Error when using Ctrl+Alt+E #23

Open siarheilemeshau opened 11 months ago

siarheilemeshau commented 11 months ago

Describe the bug When trying to autocomplete using the key combination ctrl+alt+E, an error is generated. Error word " Brush off " https://www.oxfordlearnersdictionaries.com/definition/english/brush-off_1?q=brush+off

Debug info:

Additional context (e.g., exception)

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue to the add-on author. Debug info: Anki 2.1.65 (aa9a734f) Python 3.9.15 Qt 6.4.3 PyQt 6.4.0 Platform: Windows-10-10.0.18363 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2023-11-02 15:01:46

Caught exception: Traceback (most recent call last): File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 415, in get_data_with_exception_handling get_data(editor) File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 226, in get_data definition_html = get_definition_html(words_info) File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 299, in get_definition_html description = replace_word_in_sentence(word, maybe_description, False) File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 186, in replace_word_in_sentence token, start, stop = spans[position + i] IndexError: list index out of range

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "aqt.webview", line 604, in handler File "aqt.editor", line 582, in File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 425, in func=lambda ed: ed.saveNow(lambda: get_data_with_exception_handling(ed)), File "C:\Users\lemeshau\AppData\Roaming\Anki2\addons21\570730390\autodefine.py", line 417, in get_data_with_exception_handling raise Exception("\n\nATTENTION! Please copy this error massage and open an issue on \n" Exception:

ATTENTION! Please copy this error massage and open an issue on https://github.com/artyompetrov/AutoDefine_oxfordlearnersdictionaries/issues so I could investigate the reason of error and fix it