Ask Your Question
0

PSSPY39 import error

asked 2023-04-13 05:39:59 -0600

slazar394 gravatar image

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?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2023-04-13 13:27:02 -0600

jconto gravatar image

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

Comments

This solves the problem! Thanks for the insight!

slazar394 gravatar imageslazar394 ( 2023-04-14 03:16:08 -0600 )edit
0

answered 2023-04-13 06:38:39 -0600

slazar394 gravatar image

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

answered 2023-04-13 06:17:47 -0600

perolofl gravatar image

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

import psse35
import psspy

psspy.psseinit(10)
edit flag offensive delete link more

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 gravatar imageslazar394 ( 2023-04-13 06:19:39 -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

Stats

Asked: 2023-04-13 05:39:59 -0600

Seen: 875 times

Last updated: Apr 13 '23