whodini Posted December 8, 2014 Share Posted December 8, 2014 Hey guys I've been exploring hython in-depth and I'm wondering if there is a way to capture the render statistics of a file and write it to a file. At the moment my only solution is running something like: hython myscript.py > mylog.txt However, I want to write the file from within the script and not redirect the output of the command from the shell. In my script I'm just doing something like this: import hou rop = hou.node("/out/mantra1") rop.render() # I need the output of this function Any help appreciated thank you guys! Quote Link to comment Share on other sites More sharing options...
paxsonsa Posted December 12, 2014 Share Posted December 12, 2014 I haven't been able to solve this, I thought .render() would return verbose text to store in a variable but it does not. Are you running this from the command line or with houdini? If the command line you may be able to setup an executeable of the .render() call (include all args) and use the subprocess module to get the stdout in another .py file. That's they way that initially pops into mind. Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted December 12, 2014 Share Posted December 12, 2014 I think it should work to just redirect stdout. import sys sys.stdout = open('file', 'w') print 'test' http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.