Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Based on your edit,

The response files can be waiting on user input, like you suggest, and unless it gets some input will wait forever.

It sounds like you'd prefer to skip the result if it takes too long. Perhaps you could consider running the response in a subprocess and interrupting when an error occurs?

http://stackoverflow.com/questions/1191374/subprocess-with-timeout

This question here considers how to interrupt a command that is taking too long. It looks like there is a great library called subprocess32 http://pypi.python.org/pypi/subprocess32/

which has a timeout parameter included. Then you'd need to write your PSS/E command the same way you'd call it from the commandline:

from subprocess32 import STDOUT, check_output
seconds = 5
env = {"PATH": "c:\Program Files\PTI\PSSE32\PSSBIN"}
output = check_output("psse32 -rspfile %s -nogui" % rspnsfilename, 
                      timeout=seconds, shell=True, stderr=STDOUT, env=env)