safetypy.py 文件源码

python
阅读 51 收藏 0 点赞 0 评论 0

项目:safetyculture-sdk-python 作者: SafetyCulture 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号