Closed Maltimore closed 1 year ago
Ah well. You can workaround this by launching Anki with flatpak run --filesystem=host net.ankiweb.Anki
, or workaround it permanently with flatpak override --user net.ankiweb.Anki --filesystem=host
.
This is a problem because Anki doesn’t use the portal to write the file, but instead tries to manipulate the filesystem directly. I’ll try asking around where’s the best place to fix this.
This workaround didn't seem to help in my case, it still errors:
Caught exception:
File "/app/share/anki/aqt/exporting.py", line 125, in accept
self.exporter.exportInto(file)
File "/app/share/anki/anki/exporting.py", line 288, in exportInto
media = self.doExport(z, path)
File "/app/share/anki/anki/exporting.py", line 296, in doExport
AnkiExporter.exportInto(self, colfile)
File "/app/share/anki/anki/exporting.py", line 152, in exportInto
self.dst = Collection(path)
File "/app/share/anki/anki/storage.py", line 31, in Collection
ver = _createDB(db)
File "/app/share/anki/anki/storage.py", line 211, in _createDB
db.execute("vacuum")
File "/app/share/anki/anki/db.py", line 32, in execute
res = self._db.execute(sql, a)
<class 'sqlite3.OperationalError'>: disk I/O error
I think this has been fixed by Anki. I can import/export decks from the local filesystem by default.
(Anki 2.1.49)
Thanks for looking into this, but it still doesn't work for me, neither with, nor without the above mentioned workaround. I'm also on the 2.1.49 flatpak.
I've tested this in Anki 2.1.50 and I can import and export decks as expected. Could you perhaps give the newest version a try? See #59 for a link to a test build.
Hi @ingemarberg , thanks for your work on this! If I understand correctly, the new version 2.1.50 from your pull request should be available soon on flathub as a regular update? In that case I'd like to wait until that happens and install it as a normal update, instead of figuring out how to install a test build concurrently with my normal installation. Then I will test whether it works now.
@Maltimore Yeah, I hope it will be available as a regular update soon. Please update this issue when you've been able to test version 2.1.50.
I updated to the newest anki 2.1.50. Exporting to an .apkg
file still does not work, but exporting .colpkg
and .txt
does work. When I try to export .apkg
, I get a different error than before:
DbError { info: "SqliteFailure(Error { code: SystemIoFailure, extended_code: 3850 }, Some(\"disk I/O error\"))", kind: Other }
Also, this error is shown in a popup window now, while the error that I reported above was shown on the command line where I started the anki flatpak.
I'm not sure this new problem is still related to flatpak? Over on the anki repo it seems that they are reworking the exporting code. https://github.com/ankitects/anki/issues/1018 So I'm fine with (temporarily) closing this issue.
Edit: When I try to export into the folder that is suggested by default (in my case /run/user/1000/doc/61ea60e/
, I suppose this is within the sandbox), the program hangs indefinitely with no errors.
I've reported an Anki bug at https://forums.ankiweb.net/t/bug-desktop-export-fails-in-flatpak-when-file-extension-is-not-provided-by-user/27115
tl;dr, the workaround is to type out the file extension when you save the file. Type my-deck.txt
or my-deck.apkg
, not my-deck
.
I wrote a PR to fix this: https://github.com/ankitects/anki/pull/2427
PR was merged, the fix should be in 2.61.
2.61 is out, I just confirmed that the current flatpak doesn't have this issue for me. @Maltimore can you check if you still have this issue?
Works like a charm @jrpear! Thank you to everyone involved, especially you @jrpear!
So all I'm trying to do is to export a collection as an .apkg, which seems like a very standard operation, which in turn makes me think this is a problem of the flatpak. I did do the "Tools > Check Database" as suggested in the error report. Here's the error output:
Error An error occurred. Please use Tools > Check Database to see if that fixes the problem. If problems persist, please report the problem on our support site. Please copy and paste the information below into your report. Anki 2.1.13 (3ba55990) Python 3.7.3 Qt 5.12.3 PyQt 5.12.2 Platform: Linux Flags: frz=False ao=False sv=1
Caught exception: