def create_directory_if_not_exists(self, path):
"""
Creates 'path' if it does not exist
If creation fails, an exception will be thrown
:param path: the path to ensure it exists
"""
try:
os.makedirs(path)
except OSError as ex:
if ex.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
self.log_critical_error(ex, 'An error happened trying to create ' + path)
raise
safetypy.py 文件源码
python
阅读 51
收藏 0
点赞 0
评论 0
评论列表
文章目录