Any idea why this script crashes Blender?

import bpy
import time
import logging

def my_handler(scene):
    frame = scene.frame_current
    bpy.context.scene.render.filepath = '/Users/igor/Documents/image-tex.png'
    saveend =["Scene"].frame_end
    print(saveend)["Scene"].frame_end = 1
    bpy.ops.render.render()["Scene"].frame_end = saveend

Its supposed to render one (first) frame and reset the render range on frame_change event.

Yep, you are rendering inside a frame change event which issues a frame change event. Don’t do dat!

Thought it was a matter of recursion, I saw the stack overflow. How to check if rendering in progress? Any other tips?

You simply can not do that with Blender’s current architecture.
Why do you want to render in a frame_change? Isn’t that essentially the same as clicking the Animation button that we already have?

You can make changes to the scene in the frame_change_pre handler. You can also set a flag in the render_pre handler to indicate that rendering is starting, then change it back in the render_post to indicate that rendering has stopped.

Something I wanted to test. Rendering composition to file and reloading the result in texture. It should happen on frame_change_pre and scene_update_post().

Couldn’t you just do a texture reload in the render_post handler? If it were an animated image it would always be one frame off, however.

scene_update is not reliable when rendering a frame range. You would only get one update when the frame range completes. Blender suspends scene update until the entire frame range is rendered then issues a scene update when it returns to the original frame it was on before the render process started. At least in my experience.

But I need to render it first from the compositing output. Too bad compositing is tied to scene render currently. I tried with global variables blocking render start if flagged as ongoing. No luck yet, probably my weak understanding of python, I really need to seat down and spend some time to read a primer.

The idea is to see how this:

would preform and record a video showcasing the possibilities.

What about an alternate scene?

I have fetched the output from different scenes, even Blender Internal in one scene and Cycles in another and then in a third scene composited them together.

If you could just make a full copy of the scene into another scene, then shift all of those keyframes back in time by one. Would something like that work?

Side-note: scene_update_post() occurs roughly 30 times per second, so you don’t really want to re-calculate something expensive here.