utils.py 文件源码

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

项目:stor 作者: counsyl 项目源码 文件源码
def make_dest_dir(dest):
    """Make directories if they do not already exist.

    Raises:
        OSError: An error occurred while creating the directories.
            A specific exception is if a directory that is being created already exists as a file.
    """
    dest = os.path.abspath(dest)
    try:
        os.makedirs(dest)
    except OSError as exc:
        if exc.errno == errno.ENOTDIR:
            raise OSError(errno.ENOTDIR,
                          'a parent directory of \'%s\' already exists as a file' % dest)
        elif exc.errno != errno.EEXIST or os.path.isfile(dest):
            raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号