Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

getting latest pssbin location

I am using the below code to get the latest possible pss version. I have Psse34 trial version installed def latestpssbinlocation(): import winreg ptiloc = r"SOFTWARE\PTI" ptikey = _winreg.OpenKey(winreg.HKEYLOCALMACHINE, ptiloc, 0, winreg.KEYALL_ACCESS) ptikeyinfo = _winreg.QueryInfoKey(ptikey) numptisubkeys = ptikeyinfo[0] vdict = {} for i in range(numptisubkeys): vernum = _winreg.EnumKey(ptikey, i) try: n = int(vernum[-2:]) vdict[n]=vernum except: pass

vers = vdict.keys()
vers.sort()
k = vers[-1]
lver = vdict[k]
lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0,_winreg.KEY_READ)
lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
_winreg.CloseKey(ptikey)
_winreg.CloseKey(lverkey)

return lverdir+r"\PSSBIN"

I am getting an error "Error 2" the system cannot find the file specified. How to resolve this?

click to hide/show revision 2
No.2 Revision

getting latest pssbin location

I am using the below code to get the latest possible pss version. I have Psse34 trial version installed installed

def latestpssbinlocation():
latest_pssbin_location():
    import winreg
_winreg
    ptiloc = r"SOFTWARE\PTI"
    ptikey = _winreg.OpenKey(winreg.HKEYLOCALMACHINE, _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ptiloc, 0, winreg.KEYALL_ACCESS)
_winreg.KEY_ALL_ACCESS)
    ptikeyinfo = _winreg.QueryInfoKey(ptikey)
    numptisubkeys = ptikeyinfo[0]
    vdict = {}
    for i in range(numptisubkeys):
        vernum = _winreg.EnumKey(ptikey, i)
        try:
            n = int(vernum[-2:])
            vdict[n]=vernum
        except:
            pass

pass

    vers = vdict.keys()
 vers.sort()
 k = vers[-1]
 lver = vdict[k]
 lverloc = ptiloc + "\\" + lver + "\\" + "Product Paths"
 lverkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, lverloc, 0,_winreg.KEY_READ)
 lverdir, stype = _winreg.QueryValueEx(lverkey, 'PsseInstallPath')
 _winreg.CloseKey(ptikey)
 _winreg.CloseKey(lverkey)

 return lverdir+r"\PSSBIN"

I am getting an error "Error 2" the system cannot find the file specified. How to resolve this?