Stvad / CrowdAnki

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

Error on Import #134

Closed caplett closed 3 years ago

caplett commented 3 years ago

Hello,

i have a Problem with importing a existing Anki deck from Github or from Disk.

I have the deck from here: Deck

When i try to import it i get this exception:

Fehler
Es ist ein Fehler aufgetreten. Bitte starten Sie Anki neu und halten Sie während des Startvorgangs die Umschalttaste gedrückt, damit Anki die installierten Erweiterungen temporär deaktiviert.
Wenn das Problem nur auftritt, wenn die Erweiterungen aktiviert sind, dann benutzen Sie bitte den Menueintrag Extras > Erweiterungen um die problembehaftete Erweiterung durch selektives Deaktivieren herauszufinden.
Wenn Sie die entsprechende Erweiterung herausgefunden haben, dann bitten wir, dass Sie sich mit einem entsprechenden Problembericht an die Support-Seite für Erweiterungen wenden, damit der Fehler behoben werden kann.
Debuginformationen:
Anki 2.1.40 (cf446733) Python 3.8.1 Qt 5.15.1 PyQt 5.15.1
Platform: Linux
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-06-08 16:56:43
Möglicherweise beteiligte Erweiterungen: ⁨CrowdAnki JSON exportimport Edit history Collaborate on deck creation⁩

Caught exception:
Traceback (most recent call last):
  File "/home/user/.local/share/Anki2/addons21/1788670778/anki/ui/action_vendor.py", line 31, in <lambda>
    lambda: AnkiJsonImporter.import_deck(self.window.col, self.directory_vendor))
  File "/home/user/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 114, in import_deck
    AnkiJsonImporter.import_deck_from_path(collection, Path(directory_path))
  File "/home/user/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 103, in import_deck_from_path
    if importer.load_deck(directory_path):
  File "/home/user/.local/share/Anki2/addons21/1788670778/importer/anki_importer.py", line 41, in load_deck
    deck.save_to_collection(self.collection, import_config=import_config)
  File "/home/user/.local/share/Anki2/addons21/1788670778/representation/deck.py", line 131, in save_to_collection
    self.save_decks_and_notes(collection=collection,
  File "/home/user/.local/share/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 "/home/user/.local/share/Anki2/addons21/1788670778/representation/note.py", line 115, in save_to_collection
    self.handle_import_config_changes(import_config, note_model)
  File "/home/user/.local/share/Anki2/addons21/1788670778/representation/note.py", line 131, in handle_import_config_changes
    if import_config.is_personal_field(note_model.anki_dict['name'], note_model.anki_dict['flds'][num]['name']):
IndexError: list index out of range

I tried a few work arounds from other solutions like #121 but could not make any progress. Is there any way to fix this on my end?

Thanks for your help and the great work!

caplett commented 3 years ago

I found a fix for this case. It seems like it was also error in how the deck was exported. A NoteType was missing and cards were wrongly labeld as another note type.

I fixed it by manual cleaning the deck.json. As far as i understand it this issue is known so i close this issue here.

aplaice commented 3 years ago

Thanks for filing the issue — as you've noted we're aware of the underlying problem (sorry that it's not fixed yet!), but it's still useful to have greater awareness of the scope of the bug and have additional "datapoints" of affected decks.