"docs/git@developer.sourcefind.cn:one/TransferBench.git" did not exist on "b52a25ca31624563c6af5587f131fc262b438d7f"
Unverified Commit 6ba3e626 authored by Tim Dettmers's avatar Tim Dettmers Committed by GitHub
Browse files

Merge pull request #622 from fozziethebeat/fix_permissionerror_order

Make sure bitsandbytes handles permission errors in the right order
parents e8a42e4a b4bc3369
...@@ -197,11 +197,13 @@ def remove_non_existent_dirs(candidate_paths: Set[Path]) -> Set[Path]: ...@@ -197,11 +197,13 @@ def remove_non_existent_dirs(candidate_paths: Set[Path]) -> Set[Path]:
try: try:
if path.exists(): if path.exists():
existent_directories.add(path) existent_directories.add(path)
except PermissionError as pex:
# Handle the PermissionError first as it is a subtype of OSError
# https://docs.python.org/3/library/exceptions.html#exception-hierarchy
pass
except OSError as exc: except OSError as exc:
if exc.errno != errno.ENAMETOOLONG: if exc.errno != errno.ENAMETOOLONG:
raise exc raise exc
except PermissionError as pex:
pass
non_existent_directories: Set[Path] = candidate_paths - existent_directories non_existent_directories: Set[Path] = candidate_paths - existent_directories
if non_existent_directories: if non_existent_directories:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment