I’ve used Anki almost every day for 3 years and I’ve exported my collection from a possibly dying hard drive. Long story short the collection I have is the collection I have (colpkg) and I’m trying to put it on a different computer with a possibly newer version of Anki. It is failing to import complaining about the first utf-8 byte at some point in the file.
The problem is, I can’t see really any more information than that at the point of error. It’s giving me a line number for the script (not the point of corruption in the file or unzipped stream). There is a suggestion to run Tools->Check Database. However this invokes a check on my freshly created empty collection.
I’m posting in development because I sense that the function I need just isn’t there, and I happen to be a well seasoned developer. I need to recover my collection but my goal is to do so by adding some diagnostic or moreso bridging the existing diagnostic tools over to the collection import. Once I know exactly whats wrong, I’ll deal with the collection manually. But in the mean time, I was hoping to contribute to this project I’ve used so much.
I have not cloned the git yet but I wanted to post for help here, in case there was something simple I was overlooking, and also if someone who has worked on the import/export or corrupted collections can drop any helpful starting points, like a basic plan of attack as I have no knowledge of the code base.
Thanks for reading,
soup
Anki 2.1.13 (3ba55990) Python 3.13.2 Qt 5.15.16 PyQt 5.15.10
Platform: Linux
Flags: frz=False ao=False sv=?
Caught exception:
File “/usr/share/anki/aqt/main.py”, line 908, in onImport
aqt.importing.onImport(self)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File “/usr/share/anki/aqt/importing.py”, line 286, in onImport
importFile(mw, file)
~~~~~~~~~~^^^^^^^^^^
File “/usr/share/anki/aqt/importing.py”, line 334, in importFile
if not setupApkgImport(mw, importer):
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File “/usr/share/anki/aqt/importing.py”, line 388, in setupApkgImport
replaceWithApkg(mw, importer.file, mw.restoringBackup)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/share/anki/aqt/importing.py”, line 391, in replaceWithApkg
mw.unloadCollection(lambda: _replaceWithApkg(mw, file, backup))
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/share/anki/aqt/main.py”, line 379, in unloadCollection
self.closeAllWindows(callback)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File “/usr/share/anki/aqt/main.py”, line 632, in closeAllWindows
aqt.dialogs.closeAll(onsuccess)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “/usr/share/anki/aqt/init.py”, line 95, in closeAll
onsuccess()
~~~~~~~~~^^
File “/usr/share/anki/aqt/main.py”, line 377, in callback
onsuccess()
~~~~~~~~~^^
File “/usr/share/anki/aqt/importing.py”, line 391, in
mw.unloadCollection(lambda: _replaceWithApkg(mw, file, backup))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File “/usr/share/anki/aqt/importing.py”, line 419, in _replaceWithApkg
json.loads(z.read(“media”).decode(“utf8”)).items()):
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
<class ‘UnicodeDecodeError’>: ‘utf-8’ codec can’t decode byte 0xb5 in position 1: invalid start byte