kerrickstaley / genanki

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

AttributeError: 'Model' object has no attribute 'templates'. Did you mean: 'set_templates'? #131

Closed VahedCivil closed 7 months ago

VahedCivil commented 7 months ago

Description While creating the package, I encounter the following message:

_Traceback (most recent call last): File "g:\Training\Abaqus\Python Scripting for Abaqus - By Vahed Mamqaderi\Test python codes\Test 44 - Anki in Python\main.py", line 36, in anki.SavePackage('my_package_test.apkg') File "g:\Training\Abaqus\Python Scripting for Abaqus - By Vahed Mamqaderi\Test python codes\Test 44 - Anki in Python\anki_generate\genanki_en_to_fa_vocabs.py", line 119, in SavePackage self.Package.write_to_file(packageFn) File "D:\Program Files\Python311\Lib\site-packages\genanki\package.py", line 40, in write_to_file self.write_to_db(cursor, timestamp, id_gen) File "D:\Program Files\Python311\Lib\site-packages\genanki\package.py", line 60, in write_to_db deck.write_to_db(cursor, timestamp, id_gen) File "D:\Program Files\Python311\Lib\site-packages\genanki\deck.py", line 63, in write_to_db {model.model_id: model.to_json(timestamp, self.deck_id) for model in self.models.values()}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\Python311\Lib\site-packages\genanki\deck.py", line 63, in {model.model_id: model.to_json(timestamp, self.deck_id) for model in self.models.values()}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Program Files\Python311\Lib\site-packages\genanki\model.py", line 92, in tojson for ord, tmpl in enumerate(self.templates): ^^^^^^^^^^^^^^ AttributeError: 'Model' object has no attribute 'templates'. Did you mean: 'settemplates'?

genanki version genanki-0.13.1

VahedCivil commented 7 months ago

Templates has incorrect format.