Skip to content
Snippets Groups Projects
Commit c6fb5c2e authored by Antoine Lambert's avatar Antoine Lambert
Browse files

config: Handle NotADirectoryError exception in exists_accessible

Make the function returns False when such exception is raised,
for instance when a .swh file exists in home directory.

It fixes pre-commit mypy check in swh-web for such edge cases.
parent a15d532e
No related branches found
No related tags found
No related merge requests found
Pipeline #8780 passed
......@@ -62,7 +62,7 @@ def exists_accessible(filepath: str) -> bool:
os.stat(filepath)
except PermissionError:
raise
except FileNotFoundError:
except (FileNotFoundError, NotADirectoryError):
return False
else:
if os.access(filepath, os.R_OK):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment