utils.py 文件源码

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

项目:jcchess 作者: johncheetham 项目源码 文件源码
def get_settings_from_file(filepath):
    s = None
    try:
        settings_file = os.path.join(filepath, "settings")
        f = open(settings_file, "rb")
        s = pickle.load(f)
        f.close()
    except EOFError as eofe:
        print("eof error:", eofe)
    except pickle.PickleError as pe:
        print("pickle error:", pe)
    except IOError as ioe:
        # Normally this error means it is the 1st run and the settings file
        # does not exist
        pass
    except Exception as exc:
        print("Cannot restore settings:", exc)
    #if gv.verbose:
    #    print "values read from settings file"
    #    print "colour_settings:",s.colour_settings
    return s
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号