4
$\begingroup$

When calling bpy.ops.render.render(write_still=True) from in a script I pass to blender with blender --background --python myscript.py, I get a very verbose output:

Fra:1 Mem:13.02M (0.00M, Peak 13.03M) | Time:00:00.00 | Preparing Scene data
Fra:1 Mem:13.02M (0.00M, Peak 13.03M) | Time:00:00.00 | Creating Shadowbuffers
Fra:1 Mem:13.02M (0.00M, Peak 13.03M) | Time:00:00.00 | Raytree.. preparing
Fra:1 Mem:13.05M (0.00M, Peak 13.05M) | Time:00:00.00 | Raytree.. building
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Raytree finished
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Creating Environment maps
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Caching Point Densities
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Sce: Scene Ve:112 Fa:220 La:1
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Loading voxel datasets
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Sce: Scene Ve:112 Fa:220 La:1
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Sce: Scene Ve:112 Fa:220 La:1
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Volume preprocessing
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Sce: Scene Ve:112 Fa:220 La:1
Fra:1 Mem:13.05M (0.00M, Peak 13.11M) | Time:00:00.00 | Sce: Scene Ve:112 Fa:220 La:1
Fra:1 Mem:27.33M (0.00M, Peak 27.33M) | Time:00:00.00 | Scene, Part 3-100
Fra:1 Mem:34.03M (0.00M, Peak 34.03M) | Time:00:00.00 | Scene, Part 11-100
Fra:1 Mem:38.91M (0.00M, Peak 40.43M) | Time:00:00.00 | Scene, Part 17-100
Fra:1 Mem:39.62M (0.00M, Peak 40.43M) | Time:00:00.01 | Scene, Part 19-100
Fra:1 Mem:40.12M (0.00M, Peak 40.43M) | Time:00:00.01 | Scene, Part 16-100
Fra:1 Mem:37.20M (0.00M, Peak 40.44M) | Time:00:00.01 | Scene, Part 8-100
Fra:1 Mem:37.01M (0.00M, Peak 40.44M) | Time:00:00.01 | Scene, Part 18-100
Fra:1 Mem:37.13M (0.00M, Peak 40.44M) | Time:00:00.01 | Scene, Part 1-100
Fra:1 Mem:40.11M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 24-100
Fra:1 Mem:38.76M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 21-100
Fra:1 Mem:37.59M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 4-100
Fra:1 Mem:38.62M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 26-100
Fra:1 Mem:36.70M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 5-100
Fra:1 Mem:35.06M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 23-100
Fra:1 Mem:35.52M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 6-100
Fra:1 Mem:35.56M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 2-100
Fra:1 Mem:33.42M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 30-100
Fra:1 Mem:32.94M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 10-100
Fra:1 Mem:33.87M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 13-100
Fra:1 Mem:34.24M (0.00M, Peak 41.03M) | Time:00:00.01 | Scene, Part 32-100

Is there any way to suppress this output?

$\endgroup$
  • $\begingroup$ By python console do you mean you are using subprocess.call to render from a python script? $\endgroup$ – sambler Dec 11 '15 at 19:17
  • $\begingroup$ I edited my question to clarify how I call render. $\endgroup$ – panmari Dec 11 '15 at 19:21
3
$\begingroup$

That is normal output for rendering from the cli and blender doesn't offer an option to reduce it. The way to mute it is to redirect the output for the shell, the method varies depending on the shell used. While redirection is normally used to save output to a file you can use /dev/null as a file to effectively scrap it as it is output.

For sh or bash (I believe also works in windows terminal) -

blender --background --python myscript.py > /dev/null 2>&1

for csh

blender --background --python myscript.py >& /dev/null

The above examples redirect both STDOUT and STDERR to /dev/null, to get more control you can direct only STDOUT to /dev/null (by only adding > /dev/null) which will consume blenders render progress and then print your output to STDERR, which your script can do with print(myoutput, file=sys.stderr)

Another approach is to use a script instead of calling blender directly, this will allow you to catch all of blenders output and only send your info to the terminal. By adding a unique tag you can separate your output from blenders progress report.

from subprocess import check_output

render_progress = check_output(['blender','--background','--python','myscript.py'])

msg = render_progress.split('*#*#*#')[1]

print(msg)

A similar result could also be achieved with a shell script.

$\endgroup$
  • $\begingroup$ But that will mute all output, also the one that I generate in the script myself. Is there no other way that just mutes the blender-own output? $\endgroup$ – panmari Dec 14 '15 at 7:31
  • $\begingroup$ While you can alter python's output locations blenders render progress doesn't use the python settings, so you will need to use the shell or a script to control the output. $\endgroup$ – sambler Dec 14 '15 at 12:53
  • $\begingroup$ Too bad blender is not configurable in this case. Thanks for looking into it! $\endgroup$ – panmari Dec 14 '15 at 15:39

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.