First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
3

print pss report to a file

asked Jun 4 '13

keesem gravatar image

Hello, I'm pretty new to pss and python in general, but I've made a few scripts. I have a problem, I want to export the contents of a report to a text file. I tried with this, but didn't manage to get it working:

f1=open('./testfile3.txt', 'w+')

psspy.zsys(0,4,[22,30,31,32])

psspy.zone_2(0,0,1)

print >> f1, psspy.zone_2(0,0,1)

1 answer

Sort by » oldest newest most voted
1

answered Jun 6 '13

Eli Pack gravatar image

You're not far off. You just need to redirect the report output to a file. This is because the zone_2() function doesn't return the text of the report, it returns an error code.

# Redirect generated reports to a file
psspy.report_output(islct=2, filarg="./testfile3.txt", options=[0])
# Run any functions that create a report
psspy.zsys(0,4,[22,30,31,32])
psspy.zone_2(0,0,1)
# Redirect reports back to the default
psspy.report_output(islct=2, options=[0])
link

Comments

Thanks a lot, it works perfectly! :)

keesem gravatar imagekeesem (Jun 6 '13)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

Stats

Asked: Jun 4 '13

Seen: 3,340 times

Last updated: Jun 05 '13