From 2af54d036d16c143386831c2049fba2dc33fa6c6 Mon Sep 17 00:00:00 2001 From: Vladimir Iakovlev Date: Tue, 28 Mar 2017 18:50:51 +0200 Subject: [PATCH] #623: Fix `UnicodeDecodeError` with Python 2 --- thefuck/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thefuck/utils.py b/thefuck/utils.py index d9c6d0cc..34698a7e 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -111,12 +111,15 @@ def get_all_executables(): tf_entry_points = get_installation_info().get_entry_map()\ .get('console_scripts', {})\ .keys() + bins = [exe.name.decode('utf8') if six.PY2 else exe.name for path in os.environ.get('PATH', '').split(':') for exe in _safe(lambda: list(Path(path).iterdir()), []) if not _safe(exe.is_dir, True) and exe.name not in tf_entry_points] - aliases = [alias for alias in shell.get_aliases() if alias != tf_alias] + aliases = [alias.decode('utf8') if six.PY2 else alias + for alias in shell.get_aliases() if alias != tf_alias] + return bins + aliases