Skip to content

Commit

Permalink
Catch 'PermissionError' for unreadable directories
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdGrub1384 committed Dec 6, 2020
1 parent 69750b9 commit 83d4ec9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions jedi/api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,11 @@ def __repr__(self):

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


Expand Down
7 changes: 5 additions & 2 deletions jedi/inference/sys_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 83d4ec9

Please sign in to comment.