Using the Blender Python Module bpy the rendering process bpy.ops.render.render(write_still=True) is quite verbose:

Fra:2 Mem:14.35M (0.00M, Peak 14.50M) | Preparing Scene data
Fra:2 Mem:19.00M (0.00M, Peak 19.01M) | Preparing Scene data
Fra:2 Mem:15.00M (0.00M, Peak 33.27M) Sce: Scene Ve:21001 Fa:41576 La:1
Saved: /path/to/output.png Time: 00:00.60 (Saving: 00:00.06)

I can't make use of the proposed solution to omit the script output, because the Blender renderings are embedded in a larger python project using import bpy API rather than calling a python script file.

I tried to suppress the output using a python standard method presented here, but no success.

Is there any way to reduce the verbosity of Blender renderings when using bpy module?

  • 1
    $\begingroup$ i didn't try blender as a module but see if this helps stackoverflow.com/a/11632982/2987234 $\endgroup$ – Chebhou Jan 8 '16 at 14:20
  • $\begingroup$ Great, it works! $\endgroup$ – frthjf Jan 8 '16 at 14:47
  • $\begingroup$ if you have a working solution please write a reasonable answer, so it is of some use to others. $\endgroup$ – zeffii Jan 8 '16 at 14:59

The following output redirection proposed here does work:

# redirect output to log file
logfile = 'blender_render.log'
open(logfile, 'a').close()
old = os.dup(1)
os.open(logfile, os.O_WRONLY)

# do the rendering

# disable output redirection
  • 2
    $\begingroup$ cool! even if only relatively few people need to know this answer, at least they don't have to visit a different link now. $\endgroup$ – zeffii Jan 8 '16 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.