Page MenuHome

Handler render init ignores output placeholders
Open, Confirmed, MediumPublic


Linux Ubuntu 19.04

Blender hash b'ad16af7a7e35' 2.8
Worked, some versions of 2.8

The script is for solve render output tokens.
In the scene you can find the script.

1 - run script
2 - run ctrl F12.

You will find renders in RENDER folder.
The placeholder name is not the same as render. ($File_001.png vs scenename_001png)

THANKS! << pasteall alternative



Event Timeline

Sybren A. Stüvel (sybren) triaged this task as Needs Information from User priority.

I can't reproduce this on either Blender versions ad16af7a7e350a2164204b8af50ff00836d65386 and 805cabdf177af6c71da6239ff3fc5d2524286a18 running Kubuntu Linux 18.04 LTS.

For me it renders to /home/sybren/workspace/blender-git/blender/RENDERS/Render_init_placeholder_0074.png, which is what I would expect given the output //RENDERS/$File_. It correctly replaced the $File placeholder with Render_init_placeholder.

@Eugenio Pignataro (oscurart) Can you give us more information on how to reproduce this issue?

Hi Sybren!

I send you more data.
1 video explain better than 1000 writelines.


If Blender is outputting multiple files, you must have something else going on than just a plain render to PNG. Please restart Blender to ensure you don't have any lingering persistent Python handlers. Then reset Blender to factory defaults (you can do this temporarily through File → Defaults → Load Factory Settings), run your script, and try again.

In the video your script also calls layer.update_render_passes(), which isn't in the blend file you attached. I don't see why that and the layer.update() calls would be necessary anyway.

Hi Sybren. Thanks for your help!

I erased the config for more security.

You're right, layer.update_render_passes() is not necessary. I wrote only for try it.

Tell me if you need something more.


Please don't attach huge videos, but just describe it. A few well-chosen words are much easier to digest for us developers than having to watch a video.

Okey! :)

I have not clues about problem. It's strange....


Bastien Montagne (mont29) closed this task as Archived.
Bastien Montagne (mont29) claimed this task.

More than a week without reply or activity. Due to the policy of the tracker archiving for until required info/data are provided.

Looks like we cannot reproduce the issue here…

System Information
Operating system: Ubuntu 18.10
Graphics card: GeForce GTX 1070 Ti

Blender Version
Broken: version: 2.81 hash: b'3e27dd5b553e'
Worked: it worked well in one of the first versions of the experimental 2.8.
I can't specify the moment, but it worked.

Short description of error
The handler correctly modifies the render path, but blender does not modify the placeholder.
It is important that the placeholder have the same name as the file.

Exact steps for others to reproduce the error
1- Download this .blend
2- Run script. (the script replace variables in render filepath when you hit render)
3- Hit ctrlF12
4- Go to the .blend folder and find "RENDER" folder.
5- You must see "$File_0001.png" and "Render_init_placeholder_0001.png"

The correct way for placeholder should be "Render_init_placeholder_0001.png" too.

I'm working in a tool like this (

Sybren A. Stüvel (sybren) raised the priority of this task from Needs Information from User to Waiting for Developer to Reproduce.

Hi Sybren!
I tested on windows system too, same problem.

Sybren A. Stüvel (sybren) lowered the priority of this task from Waiting for Developer to Reproduce to Confirmed, Medium.EditedTue, Aug 13, 2:23 PM

I can confirm the issue. Here is a modified blend file with a bit cleaner logic in the script:

  • Only code for the one variable that's actually used ('$File')
  • Declaring initial value for the global variable
  • Using the scene passed to the function, rather than the global bpy.context.scene
  • Some more debug prints to show when the original output filepath is restored.
  • Using pathlib to manipulate paths.
  • Configured the scene to render 3 frames at 1 sample.

The script:

import bpy
import pathlib
from import persistent

orig_filepath = ''

def replace_tokens(scene):
    global orig_filepath

    if not orig_filepath:
        orig_filepath = scene.render.filepath
    filename = pathlib.Path(
    scene.render.filepath = orig_filepath.replace('$File', filename)

    print(f'New filepath: {scene.render.filepath}')

def restore_tokens(scene):
    global orig_filepath

    if not orig_filepath:
        print('Not restoring empty filepath')

    print(f'Restoring filepath: {orig_filepath}')
    scene.render.filepath = orig_filepath
    orig_filepath = ''

Perhaps this option is so easy to implement that it can be included as native functionality.
With this addon I add small ideas that are very useful in production.