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

Ask Your Question
1

Python 3.7 w/ PSSE 34

asked Sep 10 '0

likethevegetable gravatar image

updated Sep 10 '0

Hi all. I'm getting the bad magic number error when trying to run PSSE 34 with Python 3.7. I can run it with Python 2.7 fine, however. I noticed there are two psspy paths:

psspy34 = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY27'

psspy34py3 = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY34'

Would it have to be Python 3.4 with PSSE 34?

Edit: I checked if my Python 3.7 installation is 64-bit and it is--perhaps this is the cause.

1 answer

Sort by » oldest newest most voted
2

answered Sep 11 '0

jconto gravatar image

Python 3.7 64-bit cannot be use with PSSe v.34 which is a 32-bit application. All usable python versions has to be 32-bit. That is cause of the magic number error.

When you install PSSe v.34.7, there are three psspy folders:

psspy27 - to be used with python 2.7
psspy34 - to be used with python 3.4 
psspy37 - to be used with python 3.7

To run PSSe from its GUI, edit the PSSe v.34 link icon by right-clicking and edit its "Target" field:

"C:\Program Files (x86)\PTI\PSSE34\PSSBIN\psse34.exe" -pyver 37

To run python scripts outside PSSe GUI, in a command line box (=DOS window), add the PSSE PSSBIN folder path to the PATH environ variable and use the full path for python.exe corresponding to v.37:

c:\..>c:\python37\python <python script>

To run a python script with PSSe 34.7 with python v.3.7, the path to psspy37 have to be added to the sys.path:

psspy37path = r'C:\Program Files (x86)\PTI\PSSE34\PSSPY37'
sys.path.append(psspy37path)
import psspy

To verify the python version and the psspy version, add to your python code:

print('Python ver %s'%sys.version)
print (psspy.psseversion())
link

Comments

Thanks jconto! Always appreciate your thoughtful replies. Cheers.

likethevegetable gravatar imagelikethevegetable (Sep 11 '0)

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

4 followers

Stats

Asked: Sep 10 '0

Seen: 5,002 times

Last updated: Sep 10 '20