Stvad / CrowdAnki

Plugin for Anki SRS designed to facilitate cooperation on creation of notes and decks.
MIT License
516 stars 44 forks source link

Cant import data #96

Open daalex1 opened 3 years ago

daalex1 commented 3 years ago

Hey, I´ve tried this addon for the first time and i tried to import Ultimate Geography

However this error occured. Can sb help me?

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, repeat 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.34 (8af8f565) Python 3.8.0 Qt 5.15.1 PyQt 5.15.1 Platform: Windows 10 Flags: frz=True ao=True sv=1 Add-ons, last update check: 2020-09-25 19:04:29

Caught exception: Traceback (most recent call last): File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\anki\ui\action_vendor.py", line 31, in lambda: AnkiJsonImporter.import_deck(self.window.col, self.directory_vendor)) File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\importer\anki_importer.py", line 112, in import_deck AnkiJsonImporter.import_deck_from_path(collection, Path(directory_path)) File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\importer\anki_importer.py", line 101, in import_deck_from_path if importer.load_deck(directory_path): File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\importer\anki_importer.py", line 39, in load_deck deck.save_to_collection(self.collection, import_config=import_config) File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\representation\deck.py", line 131, in save_to_collection self.save_decks_and_notes(collection=collection, File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\representation\deck.py", line 154, in save_decks_and_notes note.save_to_collection(collection, self, model_map_cache, import_config=import_config) File "C:\Users\buche\AppData\Roaming\Anki2\addons21\1788670778\representation\note.py", line 125, in save_to_collection self.anki_object.flush() File "anki\notes.py", line 67, in flush AssertionError

aplaice commented 3 years ago

Thanks for your interest in CrowdAnki (and Ultimate Geography :)), as well as for reporting the bug!

Unfortunately, CrowdAnki isn't yet compatible with the latest Anki, due to changes in Anki's internals, which CrowdAnki depends on.

As a workaround, you can (temporarily) downgrade to the previous stable Anki release (2.1.26). To do that, in your current version of Anki, you first need to go to File > Switch Profile > Downgrade & Quit (in the lower right). You can then run the older Anki version, and import the CrowdAnki deck(s). (You don't need to do anything special before upgrading back.)

(AFAICT it's the same error message and bug, as #92.)

daalex1 commented 3 years ago

Thank you very much.. I just downgraded to 2.1.26, however it still does not work for me.. First of all I dont get anymore error messages. However as soon as i File -> Crowd Anki: Import from Disk -> select "Ultimate Geography_de" select all the stuff and click "ok" it says "imprt of ultimate geopgraphy_de deck was successful." The deck is also shown but it seems like it has not imported any cards.. it is 0 Due and 0 New.

Maybe sb can help me as I am new to the Anki game and i just cant get it to work.. Thank you a ton in advance!

ohare93 commented 3 years ago

The deck is also shown but it seems like it has not imported any cards.. it is 0 Due and 0 New.

@daalex1

What options did you select on the Import Config window?

daalex1 commented 3 years ago

@ohare93 First i checked "Country, Capital, Flag, Map" "Notes" and "Media Files" is selected by default. Then a popup opened "Change note type" and i just clicked okay. Didnt work. Then i tried it once without checking anything except Notes and Media Files. Didnt work either

aplaice commented 3 years ago

Unfortunately, I've been able to reproduce the error that trying to import in 2.1.34, and then importing in 2.1.26 results in an empty deck, as @daalex1 reported.

It doesn't seem to be deterministic, (there are times when import on downgrade works as expected), but does occasionally occur.

Looking at collection.anki2 with sqlite3, it seems that the notes table is non-empty, while the cards table is empty. (I was starting with a fresh profile.)


It seems that the following steps allow importing Ultimate Geography:

  1. Use Tools > Check database resulting in:

Deleted 311 notes with no cards.

  1. Go to Tools > Manage Note Types, select Ultimate Geography and delete the note type (Delete this unused note type? Yes).

  2. Import the deck with CrowdAnki, (with Anki 2.1.26) as usual.

(For some reason, just steps 1 and 3 don't work, contrary to what I'd have expected — unfortunately I don't have time to investigate this properly at the moment.)

daalex1 commented 3 years ago

@aplaice Wow i cant believe you actually figured out a workaround.. No wonder that i would have never been able to get it running. Thank you so so much!

Offtopic: Can you somehow inspect all cards in the deck?/See how many cards/which cards are in there?

aplaice commented 3 years ago

Offtopic: Can you somehow inspect all cards in the deck?/See how many cards/which cards are in there?

You can inspect the cards by going to the card "browser" (press b or click on "Browser", at the top of the main screen) and then selecting the given deck in the sidebar (or typing in, say, "deck:Ultimate Geography" in the search bar). The number of cards in the selected deck is available at the bottom of the "Stats" (shortcut key t).