I thought that the following code (which I found here) would save all the terminal output from the function bpy.ops.render.render()
into the variable output
:
import bpy, sys, io
old_stdout = sys.stdout
render_output = io.StringIO()
sys.stdout = render_output
bpy.ops.render.render( write_still=True )
sys.stdout = old_stdout
But I still get output to the terminal (Saved: /tmp/a.png Time: 00:00.99 (Saving: 00:00.01)
) and render_output.getvalue()
returns an empty string. Why is that?
I also tested this method with bpy.ops.mesh.remove_doubles()
and it successfully redirects the output.