Ask Your Question
0

Running "Compile" and "Cload4" from python

asked 2014-08-14 21:20:16 -0500

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-12-07 11:44:47 -0500

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()
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: 2014-08-14 21:20:16 -0500

Seen: 2,615 times

Last updated: Dec 07 '20