Ask Your Question
1

Python 3.7 w/ PSSE 34

asked 2020-09-10 14:48:10 -0600

likethevegetable gravatar image

updated 2020-09-10 14:48:49 -0600

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.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2020-09-10 19:13:05 -0600

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())
edit flag offensive delete link more

Comments

Thanks jconto! Always appreciate your thoughtful replies. Cheers.

likethevegetable gravatar imagelikethevegetable ( 2020-09-11 08:58:36 -0600 )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

4 followers

Stats

Asked: 2020-09-10 14:48:10 -0600

Seen: 4,764 times

Last updated: Sep 10 '20