ohare93 / brain-brew

Automated Anki flashcard creation and extraction to/from Csv
The Unlicense
89 stars 5 forks source link

Conflict with assetmanger plugin?? #26

Closed boydkelly closed 3 years ago

boydkelly commented 3 years ago

I was wanting to take a look at this but was stopped at initializing a crowdanki repo with the error:

=== snip
 File "/var/home/bkelly/.local/lib/python3.9/site-packages/brain_brew/representation/json/crowd_anki_export.py", line 60, in _read_json_file
    self.note_models = list(map(NoteModel.from_crowdanki, self.json_data.note_models))
  File "/var/home/bkelly/.local/lib/python3.9/site-packages/brain_brew/representation/yaml/note_model.py", line 161, in from_crowdanki
    ca: cls.CrowdAnki = data if isinstance(data, cls.CrowdAnki) else cls.CrowdAnki.from_dict(data)
  File "/var/home/bkelly/.local/lib/python3.9/site-packages/brain_brew/configuration/representation_base.py", line 6, in from_dict
    return cls(**data)  # noqa
TypeError: __init__() got an unexpected keyword argument 'assetManager'

This is obviously the plugin: https://github.com/hgiesel/anki_asset_manager

Since I have a bunch of card types, I think I can no longer go back from using asset manager. But maybe this is something that can be ignored on your end. Otherwise I have been semi automatically syncing my file to a google spreadsheet via tsv export, awk scripts, and google-drive sync. Is there a way to get started with brain-view and a tsv file?

ohare93 commented 3 years ago

Sorry you're having the issue. Yes, I see the issue, your add-on has added new values that get exported via CrowdAnki, that Brain Brew is not expecting πŸ™ I will look into making a fix this coming weekend, to ignore all these other values (with a warning to let me know). I'll reply here when I have released a fix πŸ‘

Otherwise I have been semi automatically syncing my file to a google spreadsheet via tsv export, awk scripts, and google-drive sync. Is there a way to get started with brain-view and a tsv file?

Sadly no, it must be init'd with a CrowdAnki file for it to be done automatically. Not a lot of people have their cards in their own (semi-)automated csv files πŸ˜… so you're already ahead of the curve! A quick solution would be to write a simple script to remove all the "assetManager" values from the CrowdAnki file πŸ€”

ohare93 commented 3 years ago

I have fixed this issue :ok_hand: Install the latest (BrainBrew==0.3.5) and all should work :+1:

Now the init function will continue and ignore all erroneous values. Giving a warning such as:

WARNING:root:Unexpected values found when creating 'CrowdAnki': ['assetManager', 'testUselessKey']
!!! Please report this error if it seems strange

Please confirm all is fixed, and I will send out a proper release message :grin:

boydkelly commented 3 years ago

Thank you! I am just kind of a cut-and-paste hacker when it comes to python, but I managed to (after nuking the pip install):

python setup.py install --user
brainbrew init Jula__1_Vocabulaire
...
WARNING:root:Unexpected values found when creating 'CrowdAnki': ['assetManager', 'assetManagerHtml', 'nb column', 'unicardmode']
!!! Please report this error if it seems strange
WARNING:root:Unexpected values found when creating 'CrowdAnki': ['single line']
!!! Please report this error if it seems strange
...
[bkelly@toolbox CrowdAnki]$ brainbrew run recipes/source_to_anki.yaml 
INFO:root:Builder file recipes/source_to_anki.yaml is βœ” good
INFO:root:Attempting to generate Guids
INFO:root:Generate guids complete

Just have to figure out where to go from here. But at least the fix looks good!

ohare93 commented 3 years ago

Excellent! :+1: thank you for reporting the error :muscle:

Let me know if you have any questions.