First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

getting latest pssbin location

asked Feb 11 '19

vikram gravatar image

updated Feb 14 '19

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?

2 answers

Sort by » oldest newest most voted
0

answered Feb 18 '19

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...

link
0

answered Feb 11 '19

vikram gravatar image

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

link

Comments

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

jconto gravatar imagejconto (Feb 14 '19)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Feb 11 '19

Seen: 436 times

Last updated: Feb 18 '19