1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

Fix import failure on newer pythons

distutils was removed in python 3.12, causing the import of
find_executable to fail.  According to the python devs, find_executable
was never intended as an external interface to begin with (see python
issue #39260[^1]). This replaces it with shutil.which.

[^1]: https://bugs.python.org/issue39260#msg359644
This commit is contained in:
Andrew Vant 2025-02-17 20:30:01 -05:00
parent b5bbae4d1b
commit fd40122b73

View File

@ -3,7 +3,7 @@ import sys
import tty
import termios
import colorama
from distutils.spawn import find_executable
from shutil import which
from .. import const
init_output = colorama.init
@ -38,9 +38,9 @@ def get_key():
def open_command(arg):
if find_executable('xdg-open'):
return 'xdg-open ' + arg
return 'open ' + arg
""" Get a shell command calling the system's generic opener."""
cmd = which('xdg-open') or 'open'
return cmd + ' ' + arg
try: