Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] anki broken with Python 3.12
@ 2023-10-11 17:39 virinci
  2023-10-12 19:57 ` [ISSUE] [CLOSED] " ahesford
  0 siblings, 1 reply; 2+ messages in thread
From: virinci @ 2023-10-11 17:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]

New issue by virinci on void-packages repository

https://github.com/void-linux/void-packages/issues/46613

Description:
### 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 <https://github.com/ankitects/anki/pull/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.
```patch
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ISSUE] [CLOSED] anki broken with Python 3.12
  2023-10-11 17:39 [ISSUE] anki broken with Python 3.12 virinci
@ 2023-10-12 19:57 ` ahesford
  0 siblings, 0 replies; 2+ messages in thread
From: ahesford @ 2023-10-12 19:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]

Closed issue by virinci on void-packages repository

https://github.com/void-linux/void-packages/issues/46613

Description:
### 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 <https://github.com/ankitects/anki/pull/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.
```patch
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-12 19:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 17:39 [ISSUE] anki broken with Python 3.12 virinci
2023-10-12 19:57 ` [ISSUE] [CLOSED] " ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).