Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anki broken with Python 3.12 #46613

Closed
virinci opened this issue Oct 11, 2023 · 0 comments · Fixed by #46629
Closed

anki broken with Python 3.12 #46613

virinci opened this issue Oct 11, 2023 · 0 comments · Fixed by #46629
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed

Comments

@virinci
Copy link
Contributor

virinci commented Oct 11, 2023

Is this a new report?

Yes

System Info

Void 6.5.6_1 x86_64

Package(s) Affected

anki-2.1.15_6

Does a report exist for this bug with the project's home (upstream) and/or another distro?

I made a PR ankitects/anki#2723 (merged) to fix this issue in the main branch.
Additionally, this error can be fixed by applying the following patch to the current version packaged by Void Linux.

diff -Naurp0 a/anki/mpv.py b/anki/mpv.py
--- a/anki/mpv.py	2023-10-11 17:27:45.701979037 +0000
+++ b/anki/mpv.py	2023-10-11 17:27:07.376263916 +0000
@@ -39 +39 @@ import inspect
-from distutils.spawn import find_executable # pylint: disable=import-error,no-name-in-module
+from shutil import which
@@ -68 +68 @@ class MPVBase:
-    executable = find_executable("mpv")
+    executable = which("mpv")

Expected behaviour

anki command should open the Anki application.

Actual behaviour

The anki command fails because distutils Python module was deprecated in Python 3.10 and it was removed in Python 3.12. It fails with the following error:

$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 4, in <module>
    from anki import version as _version
  File "/usr/share/anki/anki/__init__.py", line 14, in <module>
    from anki.storage import Collection
  File "/usr/share/anki/anki/storage.py", line 13, in <module>
    from anki.collection import _Collection
  File "/usr/share/anki/anki/collection.py", line 26, in <module>
    from anki.sound import stripSounds
  File "/usr/share/anki/anki/sound.py", line 89, in <module>
    from anki.mpv import MPV, MPVBase
  File "/usr/share/anki/anki/mpv.py", line 39, in <module>
    from distutils.spawn import find_executable # pylint: disable=import-error,no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

Steps to reproduce

  1. Execute the command anki in terminal.
@virinci virinci added bug Something isn't working needs-testing Testing a PR or reproducing an issue needed labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-testing Testing a PR or reproducing an issue needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant