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

Ask Your Question
0

importing psspy module in a python sript

asked Apr 28 '14

anonymous user

Anonymous

updated May 29 '14

jsexauer gravatar image

I use the code

import os,sys

PSSE_LOCATION = r"D:\COMPONENTE_LOGICA\PSSE\PSSE30\PSSBIN"

sys.path.append(PSSE_LOCATION)

os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION 

import psspy

And I get this:

Traceback (most recent call last): File "<console>", line 1, in <module> File ".\psspy.py", line 56, in <module> ImportError: DLL load failed: it is not a valid win32 program

I checkeed the PSSE bin folder and I could not find a psspy.dll. There is a psspyc.pyd. Is the psspy.dll missing? Where can I get one?

Comments

The code looks fine (except for a missing underscore in the first mention of "PSSELOCATION"). Are you using Python 2.3? I haven't tried to call PSSE like this prior to v31. Do you have access to a newer version of PSSE?

Eli Pack gravatar imageEli Pack (Apr 30 '14)

2 answers

Sort by » oldest newest most voted
0

answered May 28 '14

NOC gravatar image

Hi everybody,

I'm using a PSS/E version 32 and in my python programs use the following code:

import os,sys

Path definition to include in the searching paths for the sys library

PATHPSSEINSTALLATION="C:\Program Files (x86)\PTI\PSSE32\PSSBIN" PATHLOCALPROGRAM="D:\MyProgram"

Add path definition to the paths used by sys library

sys.path.append(PATHPSSEINSTALLATION) sys.path.append(PATHLOCALPROGRAM) os.environ['PATH']=os.environ['PATH']+";"+PATHPSSEINSTALLATION

I hope the code be useful for you.

link
0

answered May 15 '14

yfwing gravatar image

Are you using Version 30 or new version? For the version 30 or earlier, it should not use psspyc.pyd. In the PSSBIN folder, you should be able to find a file named psspyc.dll. For version 31 or newer, it uses psspyc.pyd. For the newer release, it has some bugs with win32 compatibility. Upgrade your PSS/E to the Version 33.4, which resolves most of the compatibility issues.

link

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

Stats

Asked: Apr 28 '14

Seen: 1,260 times

Last updated: May 29 '14