Skip to content

Commit

Permalink
About "os.R_OK" in general.py (#8909)
Browse files Browse the repository at this point in the history
The notes says "Return True if directory has write permissions", however, the code below is "os.R_OK", I think "os.W_OK" is preferred.
  • Loading branch information
19190205wzy committed Aug 9, 2022
1 parent f5335f2 commit b551098
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def is_kaggle():
def is_writeable(dir, test=False):
# Return True if directory has write permissions, test opening a file with write permissions if test=True
if not test:
return os.access(dir, os.R_OK) # possible issues on Windows
return os.access(dir, os.W_OK) # possible issues on Windows
file = Path(dir) / 'tmp.txt'
try:
with open(file, 'w'): # open file with write permissions
Expand Down

0 comments on commit b551098

Please sign in to comment.