From 83d4ec9e847920e4b6a199a934468f467f9b9e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Labb=C3=A9?= Date: Sat, 5 Dec 2020 21:00:28 -0300 Subject: [PATCH] Catch 'PermissionError' for unreadable directories --- jedi/api/project.py | 7 +++++-- jedi/inference/sys_path.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/jedi/api/project.py b/jedi/api/project.py index 41554314..4ba6b7d0 100644 --- a/jedi/api/project.py +++ b/jedi/api/project.py @@ -366,8 +366,11 @@ class Project: def _is_potential_project(path): for name in _CONTAINS_POTENTIAL_PROJECT: - if path.joinpath(name).exists(): - return True + try: + if path.joinpath(name).exists(): + return True + except PermissionError: + continue return False diff --git a/jedi/inference/sys_path.py b/jedi/inference/sys_path.py index 48b9ac89..9dd588db 100644 --- a/jedi/inference/sys_path.py +++ b/jedi/inference/sys_path.py @@ -171,8 +171,11 @@ def _get_paths_from_buildout_script(inference_state, buildout_script_path): def _get_parent_dir_with_file(path: Path, filename): for parent in path.parents: - if parent.joinpath(filename).is_file(): - return parent + try: + if parent.joinpath(filename).is_file(): + return parent + except PermissionError: + continue return None