kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
2.06k stars 161 forks source link

Add more information to note fields != note model fields valueError #63

Closed MartinBernstorff closed 3 years ago

MartinBernstorff commented 3 years ago

https://github.com/kerrickstaley/genanki/blob/d3a5ac5d5a06ee29565a1173a1f63bbba252d265/genanki/note.py#L124

I ran into this error recently when installing genanki on a new user account (and incidentally updating it), and it was very hard to debug.

I generate thousands of cards each time across two note types, and I still don't know which note type or card generated the problem – instead, I ended up downgrading to 0.8.0.

I suggest adding model name or similar to the valueError, but am not sufficiently competent to add a new commit :-)

kerrickstaley commented 3 years ago

I made this error message more detailed and published the fix in genanki version 0.10.1, which is now on PyPI.

By the way, check out pdb.post_mortem for a way you could debug this issue without needing a fix in genanki. But I agree that the more detailed error message is helpful, thanks for the suggestion!