Ask Your Question
1

[SOLVED] Cannot load psscommon

asked 2022-10-11 08:37:56 -0500

miltonfrey gravatar image

updated 2022-10-13 11:48:51 -0500

When running my code, I get this traceback. This is only on PSSE 34.9.4 and 32 bit Python 3.9.13, using 32 bit Python 2.7.18 and PSSE 34.9.4 works just fine.

PS C:\Users\path> .\run.bat
    Traceback (most recent call last):
        File "C:\Users\path\program.py", line 26, in <module>
            import psspy
        File ".\psspy.py", line 56, in <module>
ImportError: DLL load failed while importing psscommon: The specified module could not be found.

I have done all the importing and path setting with this code.

import sys, os
PSSE_LOCATION = r'''C:\Program Files (x86)\PTI\PSSE34\PSSPY39'''
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' + PSSE_LOCATION
import psspy

The part that confuses me is that the file psspy.pyc and psscommon.pyd are both in the folder added to the path.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2022-10-13 11:48:31 -0500

miltonfrey gravatar image

SOLVED

I was able to get it working. All that was missing was import psse34 as well.

import sys, os
PSSE_LOCATION = r'''C:\Program Files (x86)\PTI\PSSE34\PSSPY39'''
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' + PSSE_LOCATION
import psse34
import psspy

This solves the DLL import issue. I'm not sure why, but there's the fix.

edit flag offensive delete link more

Comments

From rev 34 you don’t need to set the path. Just import psse34 and psspy.

perolofl gravatar imageperolofl ( 2022-10-13 13:52:24 -0500 )edit

That's what I was doing previously when using Python 2.7, but I was no longer able to get it to work in Python 3.9. It can't find psse34 even though 'C:\Program Files (x86)\PTI\PSSE34\PSSPY39' is in PATH variable.

miltonfrey gravatar imagemiltonfrey ( 2022-10-13 13:58:51 -0500 )edit

Thank you, I had the same issue and this solved it!

QuinnP gravatar imageQuinnP ( 2023-01-23 21:06:27 -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

Stats

Asked: 2022-10-11 08:37:56 -0500

Seen: 628 times

Last updated: Oct 13 '22