z1lc / AutoDefine

An add-on to Anki that auto-defines words, optionally adding pronunciation and images.
https://ankiweb.net/shared/info/2136497008
GNU General Public License v2.0
56 stars 17 forks source link

Cannot go to a card's edit note twice #18

Closed dusk-comes closed 5 years ago

dusk-comes commented 5 years ago

Describe the bug I face a bug each time when go out from card's edit mode and then go in to edit mode again.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Learning mode'
  2. When a card appears click on 'Edit'
  3. Close opened window
  4. When the card appears again click on 'Edit'
  5. Click on button 'Auto Define Word'
  6. See error

Expected behavior The add-on should put the appropriate information into fields.

Debug info: Anki 2.1.0beta36 Python 3.6.7 Qt 5.9.5 PyQt 5.10.1 Platform: Linux Flags: frz=False ao=True

Caught exception: File "/usr/share/anki/aqt/progress.py", line 67, in handler func() File "/home/dusk/.local/share/Anki2/addons21/2136497008/autodefine.py", line 91, in editor.saveNow(lambda: _get_definition(editor, force_pronounce, force_definition)) File "/home/dusk/.local/share/Anki2/addons21/2136497008/autodefine.py", line 211, in _get_definition word = clean_html(editor.note.fields[0]).strip() <class 'AttributeError'>: 'NoneType' object has no attribute 'fields'

z1lc commented 5 years ago

Thank you for the detailed bug report. I was able to reproduce this locally and push an updated version (d7485a8e0143e846d1c512bd95fa1ac64bbc8ad7) to AnkiWeb; could you check to see if the issue is resolved for you by updating your add-ons?

dusk-comes commented 5 years ago

Thank you for the detailed bug report. I was able to reproduce this locally and push an updated version (d7485a8) to AnkiWeb; could you check to see if the issue is resolved for you by updating your add-ons?

seems your changes fixed the work. thanks for your add-on.

z1lc commented 5 years ago

Great, thanks for the bug report!