You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have multiple processes writing different files to the same folder. To ensure the folder hierarchy exists I call makedirs(recreate=True) before I create the files. Sometimes this fails saying folder already exists. This is because of race condition where another process created it after the check.
The pyfilesystem code in base/makedirs has thread lock which stops this happening in threads. It also has a try except to ignore the exception for the lowest subfolder. However this should be around the creation of parent folders too:
dir_paths = tools.get_intermediate_dirs(self, path)
for dir_path in dir_paths:
self.makedir(dir_path, permissions=permissions)
try:
self.makedir(path)
except errors.DirectoryExists:
if not recreate:
raise
Activity
simonm3 commentedon Jul 17, 2019
Like this....also the code is missing a permissions parameter in the second call to makedir.
willmcgugan commentedon Jul 24, 2019
That looks sensible. Would you mind submitting a PR?
willmcgugan commentedon Jul 28, 2019
Fixed in v2.4.9