Ask Your Question
2

PSSE custom output device with python

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

anonymous user

Anonymous

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
2

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
redirect.psse2py()
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

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 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

Stats

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

Seen: 1,443 times

Last updated: Dec 06 '12