Ask Your Question
0

Exporting PV curve data from PSS/E to excel

asked 2013-11-20 22:11:23 -0500

Thomas Ebdrup gravatar image

Hi everybody I have used PSS/E for some time now but there are still a lot of thinks I don’t know how to do in PSS/E so I need some help. I want to export some PV curves from PSS/E to excel. I am using the following python code import pssexcel

string = ['v']

colabel = []

xlsfile = 'Book1.xlsx'

sheet = ' '

overwritesheet = False

show = False

namesplit = True

pssexcel.pv(nocap.pv,string,colabel=colabel,namesplit=namesplit,xlsfile=xlsfile,sheet=sheet, overwritesheet=overwritesheet,show=show)

print "Done"

And PSS/E is giving me the following error message

Executing Python file:H:\PV to excel\PV to excel.py

Traceback (most recent call last):

File "H:\PV to excel\PV to excel.py", line 3, in <module>

import pssexcel

File ".\pssexcel.py", line 36, in <module>

File ".\excelpy.py", line 168, in <module>

File "C:\Python27\lib\site-packages\win32com_init_.py", line 5, in <module>

import win32api, sys, os

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

Couldn't open Python file:H:\PV to excel\PV to excel.py

I am using PSS/E ver. 33

Does anyone know why this is not working??

All help or clues are very much appreciated

Best regards Thomas

edit retag flag offensive close merge delete

4 answers

Sort by » oldest newest most voted
1

answered 2013-11-21 18:02:01 -0500

jconto gravatar image

update your PSSe 33 installation as follows (standard installation of PSSe v.33.4.0):

Problem: error in loading “win32” module that allow Excel file to be open in python

Solution: move (not copy) files _win32sysloader.pyd and win32api.pyd

from folder C:\Program Files (x86)\PTI\PSSE33\PSSBIN

to folder C:\Program Files (x86)\PTI\PSSE33\PSSPY27

edit flag offensive delete link more
0

answered 2013-11-27 11:36:53 -0500

yfwing gravatar image

@Thomas Ebdrup, try @terrytian 's method, but you don't need import psspy if you are just going to export PV to excel. Import psspy and initialize it may create some trouble to you if your PSS/E environment is not probably set.

The problem with import pssexcel within PSS/E is known problem to PTI. It is caused by the different version of VC++ compiler used for PSS/E python modules and the Python 2.7 win32api module. The C++ runtime library used by PSS/E is not compatible with Python 2.7 module. But you can work around using @terrytian 's method.

edit flag offensive delete link more
0

answered 2013-11-26 12:58:13 -0500

terrytian gravatar image

updated 2013-11-26 12:59:25 -0500

I recommend you to run python on top of PSS/E. In other words, run the python script without PSS/E.

You can search this topic in this forum.

The basic idea is to add the following lines before your original python script to let it know where your PSS/E library installed.

import sys
import os

PSSE_LOCATION = r'C:\Program Files (x86)\PTI\PSSE33\PSSBIN' # your location may be different
sys.path.append(PSSE_LOCATION)
os.environ['PATH'] = os.environ['PATH'] + ';' +  PSSE_LOCATION

import psspy
import pssarrays
from psspy import _i, _f, _c
import redirect
redirect.psse2py()

import pssexcel # now this module can be loaded without error
psspy.psseinit() # this start the pss/e in python
edit flag offensive delete link more
0

answered 2013-11-21 21:46:47 -0500

Thomas Ebdrup gravatar image

Hi jconto thanks for your fast replay :-) Your solution didn’t do the trick! I have updated PSS/E to ver. 33.4 I moved the two files that you mention. And here is what PSS/E writ in the output bar: Executing Python file:H:\PV to excel\PV to excel1.py

Traceback (most recent call last):

File "H:\PV to excel\PV to excel1.py", line 3, in <module>

import pssexcel

File ".\pssexcel.py", line 36, in <module>

File ".\excelpy.py", line 168, in <module>

File "C:\Python27\lib\site-packages\win32com\client_init_.py", line 11, in <module>

import gencache

File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 662, in

<module>

__init__()

File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 58, in init

Rebuild()

File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 649, in Rebuild

_SaveDicts()

File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 65, in _SaveDicts

f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb")

File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 141, in

GetGeneratePath

f = open(fname,"w")

IOError: [Errno 13] Permission denied: 'C:\Python27\lib\site-

packages\win32com\gen_py\init.py'

Couldn't open Python file:H:\PV to excel\PV to excel1.py

Even the PSS/E built in tool for exporting PV data to excel is not working!! Any ideas? And does anyone have a working python code or procedure for exporting PV data to excel for PSS/E ver. 33.4?? Regerds Thomas

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

Stats

Asked: 2013-11-20 22:11:23 -0500

Seen: 2,750 times

Last updated: Nov 27 '13