Ask Your Question
0

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)
        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?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-02-18 09:12:10 -0500

wassup_doc gravatar image

I know this does not answer the question directly, but if you are simply trying to ascertain PSSE location for psspy, dyntools, etc. you might want to check out the psse library "PSSEPATH". I believe it was created by a forum contributor a few years ago. I have used it on PSSE 32, 33, an 34 with different versions of python. It works great.

Check here: https://github.com/danifus/pssepath

and the comments here: https://psspy.org/psse-help-forum/que...

edit flag offensive delete link more
0

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

Comments

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

Stats

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

Seen: 417 times

Last updated: Feb 18 '19