regcheck.py 文件源码

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

项目:purelove 作者: hucmosin 项目源码 文件源码
def CheckPythonPaths(verbose):
    if verbose: print "Python Paths:"
    # Check the core path
    if verbose: print "\tCore Path:",
    try:
        appPath = win32api.RegQueryValue(regutil.GetRootKey(), regutil.BuildDefaultPythonKey() + "\\PythonPath")
    except win32api.error, exc:
        print "** does not exist - ", exc.strerror
    problem = CheckPathString(appPath)
    if problem:
        print problem
    else:
        if verbose: print appPath

    key = win32api.RegOpenKey(regutil.GetRootKey(), regutil.BuildDefaultPythonKey() + "\\PythonPath", 0, win32con.KEY_READ)
    try:
        keyNo = 0
        while 1:
            try:
                appName = win32api.RegEnumKey(key, keyNo)
                appPath = win32api.RegQueryValue(key, appName)
                if verbose: print "\t"+appName+":",
                if appPath:
                    problem = CheckPathString(appPath)
                    if problem:
                        print problem
                    else:
                        if verbose: print appPath
                else:
                    if verbose: print "(empty)"
                keyNo = keyNo + 1
            except win32api.error:
                break
    finally:
        win32api.RegCloseKey(key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号