Ask Your Question

getting latest pssbin location

asked 2019-02-11 12:57:13 -0500

vikram gravatar image

updated 2019-02-14 16:45:10 -0500

jconto gravatar image

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)
            n = int(vernum[-2:])

    vers = vdict.keys()
    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')

    return lverdir+r"\PSSBIN"

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-02-11 13:13:19 -0500

vikram gravatar image

Instead of using "winreg.HKEYLOCALMACHINE", use "winreg.HKEYCURRENTUSER" and instead of 'PsseInstallPath' use 'PsseExePath'. This is applicable to PSSE 34

edit flag offensive delete link more


For a standard PSSe v34 installation, the original code works fine.

jconto gravatar imagejconto ( 2019-02-14 16:48:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower


Asked: 2019-02-11 12:57:13 -0500

Seen: 46 times

Last updated: yesterday