Race-safe makedir.
Might help
@@ -35,8 +35,7 @@ SOS_TOK, EOS_TOK = "<SOS>", "<EOS>"
def maybe_make_dir(dirname):
"""Make a directory if it doesn't exist."""
- if not os.path.isdir(dirname):
- os.mkdir(dirname)
+ os.makedirs(dirname, exist_ok=True)
def process_sentence(sent, max_seq_len):
