Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deck won't round-trip. #61

Closed
johnlawrenceaspden opened this issue Jul 27, 2019 · 7 comments · Fixed by #127
Closed

Deck won't round-trip. #61

johnlawrenceaspden opened this issue Jul 27, 2019 · 7 comments · Fixed by #127

Comments

@johnlawrenceaspden
Copy link

Hi, I've got a deck that won't round-trip. It seems fine in Anki, but when I export it and then import it, it gives the error below:

I'm happy to help you debug it! What do you need?

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site.
Debug info:
Anki 2.1.11 (3cf770c7) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons possibly involved: CrowdAnki JSON exportimport Edit history Collaborate on deck creation

Caught exception:
File "/home/john/.local/share/Anki2/addons21/1788670778/anki/ui/action_vendor.py", line 29, in
lambda: AnkiJsonImporter.import_deck(self.window.col, self.directory_vendor))
File "/home/john/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 80, in import_deck
AnkiJsonImporter.import_deck_from_path(collection, Path(directory_path))
File "/home/john/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 69, in import_deck_from_path
importer.load_from_directory(directory_path, import_media)
File "/home/john/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 45, in load_from_directory
self.load_from_file(directory_path.joinpath(directory_path.name).with_suffix(DECK_FILE_EXTENSION))
File "/home/john/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 30, in load_from_file
deck.save_to_collection(self.collection)
File "/home/john/.local/share/Anki2/addons21/1788670778/representation/deck.py", line 141, in save_to_collection
name = self._save_deck(collection, parent_name)
File "/home/john/.local/share/Anki2/addons21/1788670778/representation/deck.py", line 171, in _save_deck
self.anki_dict["conf"] = self.metadata.deck_configs[self.deck_config_uuid].anki_dict["id"]
<class 'KeyError'>: 'c675e2b3-9a7b-11e9-9bae-342387e2ac49'

@johnlawrenceaspden
Copy link
Author

What seems to have happened is that the deck config uuid, which is listed twice in the json file, had got out of sync with itself somehow.

Fiddling it by hand in the json and then importing the deck has fixed the issue for me.

@Stvad
Copy link
Owner

Stvad commented Jul 27, 2019

huh, let me know if it happens again!

@Stvad Stvad closed this as completed Jul 30, 2019
@johnlawrenceaspden
Copy link
Author

It happened again. I think all you need to do to provoke it is to change the options group of your deck. It would be much better if the options stuff wasn't exported anyway!

@johnlawrenceaspden
Copy link
Author

Specifically the deck_config_uuid doesn't change, but the deck_configurations/crowdanki_uuid does, and this makes the file un-importable.

@Stvad Stvad reopened this Oct 5, 2019
@gabbard
Copy link

gabbard commented Oct 9, 2019

I am also experiencing this problem, also triggered by differing options groups.

Since this breaks one of the core use cases of the plug-in (sharing decks between people, who will typically want different rates of new cards per day, etc.), would it make sense to disable options group export/import for now and then make re-enabling it a feature for the future?

@Stvad
Copy link
Owner

Stvad commented Oct 9, 2019

there is no easy way to just disable it. setting https://github.com/Stvad/CrowdAnki/blob/master/crowd_anki/representation/deck.py#L130 to false can be a quick hack for the update use case. but just setting it to false would likely break the fresh import scenario.
To make this work, the default behavior that'd choose the deck config to be default if it's not found or something like that is required here

@aplaice
Copy link
Collaborator

aplaice commented Jul 3, 2021

Looking at the error message and the description, I think that the root issue here is the same as #106 and #116!

(This issue also includes a request to avoid exporting/importing the deck config:

Since this breaks one of the core use cases of the plug-in (sharing decks between people, who will typically want different rates of new cards per day, etc.),

but that's already fully covered by #31.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants