Ask Your Question

PSSE custom output device with python

asked 2012-12-06 05:51:47 -0600

anonymous user


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

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-06 06:18:55 -0600

jsexauer gravatar image

updated 2012-12-06 06:44:13 -0600

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
old_stdout = sys.stdout  # Incase you want to restore output back to the screen
sys.stdout = open(r"C:\Filename.txt", 'w')
edit flag offensive delete link more



It can be helpful to use a contextmanager for method2 when you want to make sure STDOUT always restored to the previous location.

chip gravatar imagechip ( 2015-02-12 14:14:25 -0600 )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


Asked: 2012-12-06 05:51:47 -0600

Seen: 1,371 times

Last updated: Dec 06 '12