Ask Your Question
0

Running "Compile" and "Cload4" from python

asked Aug 15 '14

Hitech gravatar image

Hi, Everyone

I am wondering if anyone have worked out how to run "Compile" and "Cload4" from python with pss/e 32. I understand there is environment manager that can be used but I am trying to automate entire dynamic study run including these commands. I used to use batch file with Pss/e 29 and it was working fine but I am migrating all my scripts to python thinking it would be efficient.

I have tried using "subprocess" module to pass commands to "cmd" prompt but it does not quite work.


import sys,os,subprocess

def open_app():
    p=subprocess.Popen([r"C:\Windows\SysWOW64\cmd.exe"],shell=True)
    q=subprocess.Popen([r"C:\Program Files (x86)\PTI\PSSE32\SET_PSSE_PATH.BAT"],shell=True)
    subprocess.Popen(["dir/b"],shell=True)
    subprocess.Popen(['psse'])
open_app()

The above code set path for pss/e and works fine upto "dir/b" command but does not recognize "psse" as a command.

It would be great if someone can help me with this part of the code and bridge the gap in my dynamic study automation.

Thanks

1 answer

Sort by » oldest newest most voted
0

answered Dec 7 '0

GaryB gravatar image

Try this:

import subprocess

runstr = r'"C:\Windows\SysWOW64\cmd.exe" /k '\
    r'"C:\Program Files (x86)\PTI\PSSE32\SET_PSSE_PATH.BAT"'\
    r'& compile.bat'

def open_app():
    p=subprocess.call(runstr)
open_app()
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: Aug 15 '14

Seen: 2,636 times

Last updated: Dec 07 '20