[4fa73e]: / pytorch / utils / dirs.py

Download this file

18 lines (15 with data), 424 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import os
import logging
def create_dirs(dirs):
"""
dirs - a list of directories to create if these directories are not found
:param dirs:
:return:
"""
try:
for dir_ in dirs:
if not os.path.exists(dir_):
os.makedirs(dir_)
except Exception as err:
logging.getLogger("Dirs Creator").info("Creating directories error: {0}".format(err))
exit(-1)