AttributeError: 'CrowdAnkiExport' object has no attribute 'note_models'
When cloning the starter project, deleting build/, and trying to build it, I get
Traceback (most recent call last):
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/bin/brainbrew", line 8, in <module>
sys.exit(main())
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/main.py", line 19, in main
command.execute()
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/run_recipe.py", line 15, in execute
recipe = TopLevelBuilder.parse_and_read(self.recipe_file_name, self.verify_only)
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/top_level_builder.py", line 60, in parse_and_read
return cls.from_list(recipe_data)
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/recipe_builder.py", line 20, in from_list
tasks = cls.read_tasks(data)
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/recipe_builder.py", line 68, in read_tasks
task_or_tasks = [matching_task.from_repr(task_arguments)]
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/parts_builder.py", line 40, in from_repr
return cls.from_list(data)
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/recipe_builder.py", line 20, in from_list
tasks = cls.read_tasks(data)
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/commands/run_recipe/recipe_builder.py", line 73, in read_tasks
inner_task.execute()
File "/home/langston/.local/share/virtualenvs/anki-nyc-w_4Oah3X/lib/python3.9/site-packages/brain_brew/build_tasks/crowd_anki/notes_from_crowd_anki.py", line 62, in execute
ca_models = self.ca_export.note_models
AttributeError: 'CrowdAnkiExport' object has no attribute 'note_models'
System info:
- Python 3.9.6
- NixOS 21.05
- pipenv, version 2020.11.15
Interesting. CrowdAnkiExports should definitely have a note_model :sweat_smile: I will look into this shortly
I just cloned the starter project, deleted Build/, and ran brainbrew run recipes/source_to_anki.yaml with no issues :thinking:
This is a rather strange error. I can not see in the code how note_models could generate this error, as it does indeed exist :thinking: (by my understanding it is complaining there is no variable on the class called note_models, not that it is not instantiated)
Could you try on Python 3.7.10? That is what Brain Brew is specified towards. Though I would not expect a later version to do this.
Barring that, if you could try again with a fresh repo, and detail every step you take (in case any were missed) that would be great.
Aha, I can recreate the issue! I get the exact same error
Steps:
- Delete the build folder
- Run
anki_to_source.yamlinstead ofsource_to_anki.yaml
:sweat_smile: easy mistake to make, but it's essentially trying to make the source files (the csvs) from a non-existing CrowdAnki file. No clue why this results in such an error message, and I should look into fixing that :+1: But I believe your problem will be fixed by running source_to_anki.yaml :+1: Do let me know!