0

PSSPY39 import error

I'm trying to import PSSPY using the following code:

import os
import sys

PSSPY_PATH = r"C:\Program Files\PTI\PSSE35\35.4\PSSPY39"
sys.path.append(PSSPY_PATH)
os.environ['PATH'] += ';' + PSSPY_PATH

import psspy

psspy.psseinit(10)

Unfortunately, after running the above code, I get an error on the "import psspy" line:

ImportError: DLL load failed while importing psscommon: The specified module could not be found.

I checked the installation directory and I can see that "psscommon" file is available. Does anyone know how to solve this issue?

slazar394's avatar
29
slazar394
asked 2023-04-13 05:39:59 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

3 Answers

0

There is no need to set the path in rev 35. Just import psse35!

import psse35
import psspy

psspy.psseinit(10)
perolofl's avatar
3.8k
perolofl
answered 2023-04-13 06:17:47 -0500
edit flag offensive 0 remove flag delete link

Comments

Unfortunately, this doesn't work at my end. Found the solution on a related question: https://psspy.org/psse-help-forum/question/9462/solved-cannot-load-psscommon/%3C/p%3E (https://psspy.org/psse-help-forum/question/9462/solved-cannot-load-psscommon/)

slazar394's avatar slazar394 (2023-04-13 06:19:39 -0500) edit
add a comment see more comments
0

The answer is provided by @miltonfrey on question "[SOLVED] Cannot load psscommon". I can't post links, so I have to provide an answer like this. The working code, adapted from this question is:

import sys

PSSPY_PATH = r"C:\Program Files\PTI\PSSE35\35.4\PSSPY39"
sys.path.append(PSSPY_PATH)

import psse35
import psspy

psspy.psseinit()
slazar394's avatar
29
slazar394
answered 2023-04-13 06:38:39 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

To assure that "import PSSe35" will work (assumes default paths during installation):

go to PSSe35 folder installation\PSSPY39 copy psse35.py and pssloc.pyc

open python installation folder (for v.3.9, 64 bit), go to lib folder then site-packages folder (i.e.: C:\Users\xx\AppData\Local\Programs\Python\Python39\Lib\site-packages) and paste those two files there.

You may run the following code in a DOS window to print the python.exe path in your pc:

import sys
print (sys.executable)
jconto's avatar
2.9k
jconto
answered 2023-04-13 13:27:02 -0500
edit flag offensive 0 remove flag delete link

Comments

This solves the problem! Thanks for the insight!

slazar394's avatar slazar394 (2023-04-14 03:16:08 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer