From 4c4a51cb6bd01e2e813354502b8327285fc00e75 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 25 Oct 2019 05:19:13 +0800 Subject: [PATCH] Do not crash when failing to read an entry (#1090) --- black.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/black.py b/black.py index 24ab660..ada9b0e 100644 --- a/black.py +++ b/black.py @@ -3491,6 +3491,9 @@ def gen_python_files_in_dir( # Then ignore with `exclude` option. try: normalized_path = "/" + child.resolve().relative_to(root).as_posix() + except OSError as e: + report.path_ignored(child, f"cannot be read because {e}") + continue except ValueError: if child.is_symlink(): report.path_ignored( -- 2.39.5