Changing text for each frame in animation

I need to create a series of images with one letter in each image. I set up my camera to point at Text object with one letter in it. In python console I am trying to animate it.

I can change letters in the Text object as this:

char = bpy.data.objects["Font"].data
char.body = 'B'

I see in the 3D view that letter changed to ‘B’. But, if I try to animate with

char.keyframe_insert( data_path='body', frame=1 )

I got message that property “body” is not animatable.

So I guess my approach should be different. I should not animate it but change letters in the loop and render frame by frame in each loop iteration?

I’ve tried it. It seems to work but when I use

bpy.ops.render.render( animation=False, write_still=True )

I do not see any images in my output folder. Why are they not being written? And how do I make sure new frame will not overwrite previous one?

After some struggling I have done it with the following script:

import bpy

charSet = [ ' ', '!', '"', '#', '$', '%', '&', '\'', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',  '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~' ]

def generateFrame():
    text = bpy.data.objects["Font"].data
    scene = bpy.context.scene
    for c in range( 0, 96 ):
        scene.frame_start = c
        scene.frame_end = c
        text.body = charSet[c]
        bpy.ops.render.render(animation=True, write_still=True, layer="", scene="" )
    return


def run():
    generateFrame()
    return

if __name__ == "__main__":
    run()

I had to play with scene.frame_start and scene.frame_end so that for each frame I execute bpy.ops.render.render with animation parameter “True” because only in this way I see my images being written to disc.

And since I want file names to be in incrementing order 0001.png 0002.png and so on I had to do that trick.

Even though I have generated the sequence I needed still interested to find out a more “proper” way to do it.