Is there way to suppress (and possibly process) console output when rendering from script? I have batch script to set up model material etc. via CLI and I want to show overall progress of the job (for example "Image1.png done", "Image2.png done" etc...).

I want to get rid of these lines:

Fra:5 Mem:115.16M (0.00M, Peak 213.60M) | Time:17:15.52 | Remaining:07:30.02 | Mem:26.82M, Peak:26.82M | Scene, Render-Alpha | Path Tracing Tile 45/64, Sample 1079/2000

to make output more readable. Is there any way to do it?

It would be nice to display rendering progress without flooding console (for example as "50% done", but this would be just finishing touch :D) - I would be glad to just remove console output completely.

I tried redirecting output via:

sys.stdout = io.StringIO()

and some other examples using contextlib.contextmanager but neither did work (console was still flooded with progress messages)

I would like to do it directly in python - I am on Windows so using grep awk or other tools is complicated. Plus it would be nice to control script output from one place.

  • $\begingroup$ there is a a command line argument --verbose it could help you but I can't find any documented list of values, see also blender.stackexchange.com/questions/3049/… $\endgroup$
    – m.ardito
    Nov 10 '15 at 9:44
  • $\begingroup$ possible duplicate: blender.stackexchange.com/questions/28615/… $\endgroup$
    – zeffii
    Nov 10 '15 at 10:02
  • $\begingroup$ @zeffii: Didn't found that one :/. But this no solution would work, as I need to print some other text. Thanks anyway. $\endgroup$
    – postolka
    Nov 11 '15 at 0:05
  • $\begingroup$ @DominiqueParisot your comment is actually a great answer! Just convert it to an answer please :) $\endgroup$
    – TeeTrinker
    Oct 22 '17 at 20:43

Unfortunately, the message you want to get ride (Fra:5...) is printed directly on stdout by a fprintf function (source/blender/render/intern/source/pipeline.c). It's not printed by a specific function which has a hook with python... And I don't think the embedded Python engine has the power to act on the pipe between the console and Blender. I think the only way to do what you want is to write an external launcher script to filter Blender stdout. As you don't want to use external tools like awk, you can use the Blender python engine which is in the blender directory.


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.