First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

import psse to python

asked Mar 27 '18

YI-WEI gravatar image

updated Mar 27 '18

Is PSSE33 connected to python, does python2.7 have to be 32-bit or 64-bit? Because I try 32-bit it can work, 64-bit cannot. In addition, PSSE and python connection only need to install PYWIN32? Because recently to help install a new computer, a bit forget how to do before

2 answers

Sort by » oldest newest most voted
1

answered Mar 27 '18

jconto gravatar image

PSSe33 was built as a 32-bit application. Anything 32-bit will be compatible with it. Some 64-bit apps or OS can handle interactions with 32-bit apps. Yes, install pywin32. You can use pip (located at the scripts folder of the python installation) to install python modules.

in a DOS windows: c:..>pip install pyapp_name

link

Comments

So python 64-bit may not work?

YI-WEI gravatar imageYI-WEI (Mar 28 '18)

You are welcome to try it but at least you know that python-32 bit works with PSSe.

jconto gravatar imagejconto (Mar 28 '18)

Hello, why cannot I import psspy in python after pip install pywin32?

Linzhi gravatar imageLinzhi (Apr 6 '18)

pywin32 should not affect psspy loadability. can you share the first lines of code before attempting to load psspy?

jconto gravatar imagejconto (Apr 6 '18)

I just typed in "import psspy", but got "No Module name psspy". Besides, Jose I have some other more urgent questions that I am looking forward to guidance, could I send you emails for help?

Linzhi gravatar imageLinzhi (Apr 6 '18)
0

answered Sep 11 '19

drsgao gravatar image

psspy in PSSE v33 is a 32-bit pyd and it won't work if you use a 64-bit Python interpreter to run it.

There is a workaround. You can call Python 32-bit interpreter in your 64-bit interpreter.

The post is here : https://stackoverflow.com/questions/2...

But you may need to change the "Version" to the full path of your 32-bit Python.

Example:

import execnet

def call_python_version(Version, Module, Function, ArgumentList):
        gw      = execnet.makegateway("popen//python=%s" % Version)
        channel = gw.remote_exec("""
            from %s import %s as the_function
            channel.send(the_function(*channel.receive()))
        """ % (Module, Function))
        channel.send(ArgumentList)
        return channel.receive()

result = call_python_version(r"C:\Python27\python.exe", "psspy", "case",  
                                 ['<path to your SAV file>'])    
print(result)

This code should print the errorcode from psspy.case()

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Mar 27 '18

Seen: 2,187 times

Last updated: Sep 11 '19