Unverified Commit 268f6176 authored by nv-dlasalle's avatar nv-dlasalle Committed by GitHub
Browse files

Fix race condition in creating directory (#3696)


Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent bf5497a2
...@@ -3,8 +3,8 @@ import os ...@@ -3,8 +3,8 @@ import os
import json import json
def set_default_backend(default_dir, backend_name): def set_default_backend(default_dir, backend_name):
if not os.path.exists(default_dir): # the exists_ok requires python >= 3.2
os.makedirs(default_dir) os.makedirs(default_dir, exists_ok=True)
config_path = os.path.join(default_dir, 'config.json') config_path = os.path.join(default_dir, 'config.json')
with open(config_path, "w") as config_file: with open(config_path, "w") as config_file:
json.dump({'backend': backend_name.lower()}, config_file) json.dump({'backend': backend_name.lower()}, config_file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment