Instalei o safeeyes no Ubuntu 24.04 e não funciona.
Quando o executo na linha de comando, recebo o seguinte erro.
$ safeeyes
Traceback (most recent call last):
File "/usr/bin/safeeyes", line 33, in <module>
sys.exit(load_entry_point('safeeyes==2.1.5', 'console_scripts', 'safeeyes')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/safeeyes", line 25, in importlib_load_entry_point
return next(matches).load()
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/safeeyes/__main__.py", line 32, in <module>
from safeeyes import utility
File "/usr/lib/python3/dist-packages/safeeyes/utility.py", line 24, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
Como corrigi-lo?
A versão do safeeyes fornecida com o Ubuntu 24.04 não é compatível com python3.12, a versão python padrão do Ubuntu 24.04.
Para corrigir isso, você pode aplicar manualmente o patch do upstream . Correr
sudo nano /usr/lib/python3/dist-packages/safeeyes/utility.py
.Comente (ou remova) a linha 24,
import imp
Em seguida, substitua a linha 357 (
imp.find_module(module)
) porimportlib.util.find_spec(module)
.Agora os safeeyes devem funcionar normalmente.