0

I render an animation using a Python script inside of the Blender 2.82a text editor:

import bpy
import os
import sys

import datetime

a = datetime.datetime.now()

bpy.ops.render.render(animation=True)

b = datetime.datetime.now()

print(f"Render Time: {b-a}")
print()

The console outputs information for every frame:

Append frame 0
    Time: 00:00.09 (Saving: 00:00.00)
Append frame 1
    Time: 00:00.07 (Saving: 00:00.02)
...
Append frame 60
    Time: 00:00.04 (Saving: 00:00.00)

Render Time: 0:00:03.429938

I'd like to suppress the "Append frame...." lines (but not suppress any other console messages like print(), etc.).

This question has been asked a lot and I have tried all the various answers but all attempts at suppressing the Blender console's stdout have not been able to suppress this (Render Frame info) part of the output (although I can suppress other things like print() statements. etc.).

Thank you

  • 1
    Just to be clear, should all output of bpy.ops.render.render(animation=True) not appear on stdout or just the "Append frame" line? – Robert Gützkow Apr 23 '20 at 19:31
  • I would like to suppress all the frame line reports (it does one for every frame): "Append frame 1 Time: 00:00.07 (Saving: 00:00.02)" but I'd keep things like print(). –  Apr 23 '20 at 20:08
  • 1
    This would most likely require to start Blender from command line to redirect stdout for the executable, since the part that prints these statements is in Blender's C code and not part of a Python script. Changing stdout for the Python interpreter won't affect it, as explained in this answer. If you could tell us why you don't want these lines in the output perhaps we there are other solutions as well. – Robert Gützkow Apr 23 '20 at 20:19
  • 1
    For the the test code I placed above it is not a problem since I only have print() at the end of the run. But if I have a case where I want to print some diagnostics to the console prior to the render, then render, then print more diagnostics post-render, it would be a problem for a larger render since I will have thousands of lines of "Append frame...." in between my other print statements. I think what I might do is print my diagnostics to a file and use that so that whatever else goes to the console will not matter. –  Apr 23 '20 at 20:34
  • 1
    That sounds like a good solution. – Robert Gützkow Apr 23 '20 at 20:44

0 Answers0