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:
parent
b5bbae4d1b
commit
fd40122b73
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user