Fixing Python2 compatibility issues. Adding inline docs (#3656)

This commit is contained in:
Devin Petersohn
2018-12-28 22:53:28 -08:00
committed by Robert Nishihara
parent aad3c50e2d
commit eb1e5fa2cf
+10 -2
View File
@@ -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():