mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
About "os.R_OK" in general.py (#8909)
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.
This commit is contained in:
parent
f5335f22bb
commit
b551098d59
@ -69,7 +69,7 @@ def is_kaggle():
|
|||||||
def is_writeable(dir, test=False):
|
def is_writeable(dir, test=False):
|
||||||
# Return True if directory has write permissions, test opening a file with write permissions if test=True
|
# Return True if directory has write permissions, test opening a file with write permissions if test=True
|
||||||
if not test:
|
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'
|
file = Path(dir) / 'tmp.txt'
|
||||||
try:
|
try:
|
||||||
with open(file, 'w'): # open file with write permissions
|
with open(file, 'w'): # open file with write permissions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user