From b551098d59cce7aa9755b711b9cbe49758d3beae Mon Sep 17 00:00:00 2001 From: Code-Bat <55933273+19190205wzy@users.noreply.github.com> Date: Tue, 9 Aug 2022 22:59:36 +0800 Subject: [PATCH] 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. --- utils/general.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/general.py b/utils/general.py index 85f98cb140b9..8469773f17f2 100755 --- a/utils/general.py +++ b/utils/general.py @@ -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