getting latest pssbin location
I am using the below code to get the latest possible pss version. I have Psse34 trial version installed
def latest_pssbin_location():
import _winreg
ptiloc = r"SOFTWARE\PTI"
ptikey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, ptiloc, 0, _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
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?