Ask Your Question
0

How to "run automation file" through a python instruction (API)?

asked 2018-02-14 08:27:57 -0500

IEQQ02 gravatar image

updated 2018-02-14 09:41:03 -0500

jconto gravatar image
PSSE_PATH = r'C:\Program Files (x86)\PTI\PSSE32\PSSBIN'

sys.path.append(PSSE_PATH)

os.environ['PATH'] += ';' + PSSE_PATH

import psspy

psspy.psseinit(0) 

psspy.case(str(archivo_sav.name))

#Here: "Run Automation File with python API"

psspy.save(os.path.join(Ruta,r"Archivo_prueba.sav"))

psspy.close_powerflow()
edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2018-02-14 12:47:50 -0500

perolofl gravatar image

Use execfile to execute a Python script inside a script, e.g. execfile(”xxx.py”)

edit flag offensive delete link more

Comments

Thank you very much!!

IEQQ02 gravatar imageIEQQ02 ( 2018-02-14 15:05:48 -0500 )edit
0

answered 2018-02-14 10:18:25 -0500

jconto gravatar image

The variable 'archivo_sav.name', 'Ruta' are not defined, add something like:

archivo_sav_name = 'savnw.sav'
Ruta = 'c:\temp'

To run a python script: From the PSSe GUI, select the play icon, then set file type as *.py and select your python code. Functions names (like xx) in the API manuals require to be called with "psspy.xx" in your code.

edit flag offensive delete link more

Comments

Okay, but I want to know if it's possible to call or execute a python code without clicking on the icon. Do it using a "psspy." command

IEQQ02 gravatar imageIEQQ02 ( 2018-02-14 10:37:54 -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

2 followers

Stats

Asked: 2018-02-14 08:27:57 -0500

Seen: 893 times

Last updated: Feb 14 '18