10
$\begingroup$

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.

$\endgroup$
4
  • $\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
    Commented Nov 10, 2015 at 9:44
  • 1
    $\begingroup$ possible duplicate: blender.stackexchange.com/questions/28615/… $\endgroup$
    – zeffii
    Commented Nov 10, 2015 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
    Commented Nov 11, 2015 at 0:05
  • $\begingroup$ @DominiqueParisot your comment is actually a great answer! Just convert it to an answer please :) $\endgroup$
    – TeeTrinker
    Commented Oct 22, 2017 at 20:43

1 Answer 1

2
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .