mirror of
https://github.com/ankitects/anki.git
synced 2026-05-16 17:22:54 -04:00
## Linked issue (required) [[<!-- Fixes #123 / Closes #123 / Refs #123 -->](https://forums.ankiweb.net/t/anki-collection-collection-export-anki-package-crashes-if-given-a-relative-path-with-one-component/69562)](https://forums.ankiweb.net/t/anki-collection-collection-export-anki-package-crashes-if-given-a-relative-path-with-one-component/69562) ## Summary / motivation (required) See discussion about this on [the forum](https://forums.ankiweb.net/t/anki-collection-collection-export-anki-package-crashes-if-given-a-relative-path-with-one-component/69562) ## Steps to reproduce (required, use N/A if not applicable) `demo.py`: ```python import tempfile from pathlib import Path import anki.collection with tempfile.TemporaryDirectory() as tempdir: tempdir = Path(tempdir) col = anki.collection.Collection(str(tempdir / "temp.anki2")) col.export_anki_package( out_path="output.apkg", options=anki.collection.ExportAnkiPackageOptions(), limit=None, ) ``` ```console $ python demo.py Traceback (most recent call last): [... some noise elided here ...] File "/nix/store/1w7swjzmjp7171yspih1q07a9vgacjzb-dev-env/lib/python3.14/site-packages/anki/_backend_generated.py", line 2037, in export_anki_package raw_bytes = self._run_command(37, 4, message.SerializeToString()) File "/nix/store/1w7swjzmjp7171yspih1q07a9vgacjzb-dev-env/lib/python3.14/site-packages/anki/_backend.py", line 171, in _run_command raise backend_exception_to_pylib(err) anki.errors.BackendIOError: Failed to open '': No such file or directory (os error 2) ``` ## How to test (required) I added a unit test. It passes. ### Checklist (minimum) - [ ] I ran `./ninja check` or an equivalent relevant check locally. - [x] I added or updated tests when the change is non-trivial or behavior changed. ### Details <!-- Commands, manual steps, edge cases, and what you observed --> ## Before / after behavior (optional) <!-- For bugfixes: behavior before vs after. For other types: N/A or a short note. --> ## Risk / compatibility / migration (optional) <!-- Breaking changes, rollout notes, or N/A for small / low-risk PRs --> ## UI evidence (required for visual changes; otherwise N/A) <!-- Screenshot or short video --> ## Scope - [x] This PR is focused on one change (no unrelated edits). --------- Co-authored-by: Abdo <abdo@abdnh.net>
Anki's Rust code.