From bd5f5045aa208e737ce61f77b279574cd5a8e31b Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 21 Apr 2015 08:57:35 +0200 Subject: [PATCH] #71 Handle `iterdir` iterator fails --- setup.py | 2 +- thefuck/rules/no_command.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ee4c54dc..a552b9d6 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup(name='thefuck', - version="1.21", + version="1.22", description="Magnificent app which corrects your previous console command", author='Vladimir Iakovlev', author_email='nvbn.rm@gmail.com', diff --git a/thefuck/rules/no_command.py b/thefuck/rules/no_command.py index cfeab056..ce90926c 100644 --- a/thefuck/rules/no_command.py +++ b/thefuck/rules/no_command.py @@ -12,8 +12,8 @@ def _safe(fn, fallback): def _get_all_bins(): return [exe.name - for path in os.environ['PATH'].split(':') - for exe in _safe(lambda: Path(path).iterdir(), []) + for path in os.environ.get('PATH', '').split(':') + for exe in _safe(lambda: list(Path(path).iterdir()), []) if not _safe(exe.is_dir, True)]