2
$\begingroup$

I have a remote render system on Linux that uses a subprocess to run Blender in the background, and log and parse all of the output. In addition to the Blender output, I would use print functions in the python startup script to log progress of the script. This worked great for over a year, but only until recently the Python script started outputting the prints to stdout after the render.

A few observations:

  1. Thinking it was an order or operations issue, I've tried changing the order of arguments (-b and -P), but with no resolve*
  2. stderr does output prior to render
  3. Only seems to happen when using the Cycles engine
  4. To make sure it's wasn't a script issue, I experienced the same with an empty script with a single print
  5. My script still works as expected on 2.9.11
  • To give some examples, here are the commands used:
# Logs to stdout immediately
$ blender -P script.py scene.blend -b -y > output

# Log to stdout after the render completes
$ blender -P script.py scene.blend -b -y -f 1 > output

# Alternative script placement (tested after background and file flags)
$ blender scene.blend -b -P script.py -y > output
$\endgroup$
2
  • 1
    $\begingroup$ I'd use the python script to run the render instead of the CLI. Otherwise, maybe this could help: python - How to run a script before rendering - Blender Stack Exchange $\endgroup$
    – L0Lock
    Oct 29, 2022 at 1:26
  • $\begingroup$ Thanks for the suggestion! I should mention this is for remote rendering, so the CLI is quite important. If the render logs could be retained, this would certainly be an alternative. Cheers! $\endgroup$
    – DBrown
    Nov 1, 2022 at 22:29

1 Answer 1

0
$\begingroup$

The only way I found to get around this new behavior was to execute Blender twice during my scripted render.

The first execution of Blender is used to run the script, update the scene file, bake simulations, and show the previously mentioned script logs. Once the blender process exits, a second Blender process is run to render the scene, without the startup script.

Example:

blender myscene.blend -b -y -P startup.py \
  && blender myscene.blend -b -y -a

I still cannot find any documentation of this change, and even wonder if it was even intentional. Either way, I'd like to know why this change was made, as well as why the CLI constantly receives undocumented changes.

$\endgroup$

You must log in to answer this question.

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