fileparam.py 文件源码

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

项目:PyMal 作者: cysinfo 项目源码 文件源码
def set_location(_option, _opt_str, value, parser):
    """Sets the location variable in the parser to the filename in question"""
    if not os.path.exists(os.path.abspath(value)):
        debug.error("The requested file doesn't exist")
    if parser.values.location == None:
        slashes = "//"
        # Windows pathname2url decides to convert C:\blah to ///C:/blah
        # So to keep the URLs correct, we only add file: rather than file://
        if sys.platform.startswith('win'):
            slashes = ""
        parser.values.location = "file:" + slashes + urllib.pathname2url(os.path.abspath(value))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号