Ask Your Question

I'm trying to use psspy and always I get the same error: bad magic number in 'psspy': b'\x03\xf3\r\n'. Someone can help me to fix this error?

asked 2022-10-25 15:53:52 -0500

pmrm gravatar image

I'm using PSSe 35.3 and PSSPY39

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2024-07-02 07:21:36 -0500

updated 2024-07-02 07:24:16 -0500

The Python version which is by default used in windows can be seen by typing the following in cmd window:

If you open the PSSE installation folder, you should have the same version of PSSPY folder, otherwise, the bad magic error happens.

For example, if you are using Python 3.11, you must have PSSPY311 in the PSSE installation folder (C:\Program Files\PTI\PSSE35\35.6\PSSPY311), other wise, running the Py script won't be successful.

One trick would be to delete all non-relevant Python versions from your computer by control panel/remove programs

edit flag offensive delete link more

answered 2022-10-26 14:05:03 -0500

jconto gravatar image

Can you post a few lines of your python code up to the line causing the error to occur?

When opening a sav file by double-clicking on its name/icon, make sure it is set to use PSSe v.35 and then your python 3.9 scripts would run fine. If not, open PSSe GUI from the link provided during installation, open your case, then run your script.

When loading/running compiled code (*.pyc), make sure it was compiled with python 3.9

If you got access to the python source code, delete its pyc version.

edit flag offensive delete link more

answered 2022-10-26 07:08:32 -0500

aomar gravatar image

updated 2022-10-26 07:12:06 -0500

The python interpreter version must be the same as the version of psspy, otherwise you'll get ImportError. Since you are using psspy39, you will need to use python 3.9 (32-bit).

edit flag offensive delete link more


PSSe v35 uses python 3.9 (64-bit)

jconto gravatar imagejconto ( 2022-10-26 13:50:58 -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


Asked: 2022-10-25 15:53:52 -0500

Seen: 2,036 times

Last updated: Jul 02