Skip to content

Commit

Permalink
Fixing Python2 compatibility issues. Adding inline docs (ray-project#…
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-petersohn authored and robertnishihara committed Dec 29, 2018
1 parent aad3c50 commit eb1e5fa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/ray/tempfile_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,16 @@ def try_to_create_directory(directory_path):
# important when multiple people are using the same machine.
try:
os.chmod(directory_path, 0o0777)
except PermissionError:
pass
except OSError as e:
# Silently suppress the PermissionError that is thrown by the chmod.
# This is done because the user attempting to change the permissions
# on a directory may not own it. The chmod is attempted whether the
# directory is new or not to avoid race conditions.
# ray-project/ray/#3591
if e.errno in [errno.EACCES, errno.EPERM]:
pass
else:
raise


def get_temp_root():
Expand Down

0 comments on commit eb1e5fa

Please sign in to comment.