2

PSSE custom output device with python

How can i make PSSE write its output to file instead of console in python?

Thanks in advance.

anonymous user
asked 2012-12-06 05:51:47 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

Method 1: Progress_Output

import psspy
ierr = psspy.progress_output(2,r"C:\Filename.txt", [0, 0])

Method 2: Redirect module (captures all output, not just the progress output)

import psspy, redirect, sys
redirect.psse2py()
old_stdout = sys.stdout  # Incase you want to restore output back to the screen
sys.stdout = open(r"C:\Filename.txt", 'w')
jsexauer's avatar
586
jsexauer
answered 2012-12-06 06:18:55 -0500, updated 2012-12-06 06:44:13 -0500
edit flag offensive 0 remove flag delete link

Comments

1

It can be helpful to use a contextmanager for method2 when you want to make sure STDOUT always restored to the previous location. http://stackoverflow.com/a/28486632/653689

chip's avatar chip (2015-02-12 14:14:25 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer