Ask Your Question
1

ImportError: DLL Load failed:...

asked 2016-07-31 22:20:22 -0500

lleb gravatar image

Sadly I am not sure how to load screen shots for this so I hope my explanation is clear.

I have a fresh install of the student vs. of PSSe with Python. I am attempting to teach myself how to use them. There are some very good video tutorials out there, but none of them address this type of issue.

I am running win7 (yeah i know MS Windows is not the best for programming, but hey its what companies use, so its what I am learning on) and PSSE 34 with I believe python 2.7.

I have verified the path of psse: C:\program files (x86)\pti\pssexplore34\

I found psspy.pvc and psspy.pyd in the psspy27 sub-directory of above. All I am attempting to perform right now is to get python to call psspy and run a simple 100 node example file.

following this video: https://www.youtube.com/watch?v=nHrAA...

My script looks as follows:

`import os

import sys

PSSE_PATH = r"C:\Program Files (x86)\PTI\PSSExplore34\PSSPY27"
sys.path.append(PSSE_PATH)
os.environ['PATH'] += ';' + PSSE_PATH

import psspy

psspy.psseinit(100)`

when I run the above script I get the following output from python shell:

 ====================== RESTART: C:/Python27/program1.py ======================

Traceback (most recent call last):
  File "C:/Python27/program1.py", line 8, in <module>
    import psspy
  File ".\psspy.py", line 56, in <module>
ImportError: DLL load failed: The specified module could not be found.

Sorry to be a bother, but next? What DLL is missing, were do I get said DLL, and how do I resolve this error so I can start to practice?

Thank you in advance.

edit retag flag offensive close merge delete

Comments

Is that the correct path? I would expect it to be `C:\Program Files (x86)\PTI\PSSExplore34\PSSBIN`. And there should be a some libraries in it (`.pyd` or `.dll` files)

chip gravatar imagechip ( 2017-10-30 20:08:20 -0500 )edit

4 answers

Sort by ยป oldest newest most voted
0

answered 2017-11-05 21:38:15 -0500

jeremy.harris.ee gravatar image

I had a similar problem recently, I'd be interested if this got resolved. I was getting this same error when trying to "import excelpy". I was able to get it to run from pythonwin.exe, but not from inside PSSE.

edit flag offensive delete link more

Comments

Your is a excelpy problem. Check the post "How to install modules in PSSEXplore34"

jconto gravatar imagejconto ( 2017-11-06 17:19:02 -0500 )edit
0

answered 2017-10-30 20:01:43 -0500

jconto gravatar image

Try: psspy.psseinit(10)

It could be that the student version is limited to a small number of buses. Check the release document.

edit flag offensive delete link more
0

answered 2017-10-30 06:27:59 -0500

poppis gravatar image

Did you ever find a solution to this?

edit flag offensive delete link more
0

answered 2017-10-30 20:29:23 -0500

chip gravatar image

Troubleshooting DLL imports

In general the error message:

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

Indicates that the python interpreter can not find the library it is looking for. There are a couple steps I take to debug this issue.

Does the path actually exist

Be paranoid and check in the python script that the path actually exists:

import os 
PSSE_PATH = r"C:\Program Files (x86)\PTI\PSSExplore34\PSSPY27" 
if not os.path.exists(PSSE_PATH):    
    print "Bad path"

Is the dll/pyd in the path?

There is a file out there called psspy.dll or psspy.pyd that contains the psspy library. It's like this for any library. Make sure the directory contains the psspy library file. I would just do this on the file system, but lets be paranoid and do it in the script:

# continued from previous script
import glob
fns = glob.glob(os.path.join(PSSE_PATH, 'psspy.*'))
if len(fns) == 0:
   print "Who moved my libraries"

Broken libraries

This is not what is happening to you, but I include it because it is another common class of problems you have when importing a compiled library. You may get an error message which indicates that the library load failed for another reason, like:

ImportError: DLL load failed: %1 is not a valid Win32 application.

In most cases these are caused by a 32/64 bit issue.

edit flag offensive delete link more

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: 2016-07-31 22:20:22 -0500

Seen: 5,191 times

Last updated: Nov 05 '17