b25 python renders each image twice

Hallo,

i have the problem that my animation wich is created via python, renders every image two times. can someone tell me why?
here are the commands i use:


from bpy import *
from random import *

framelimit = 250
frame = 1

while frame < (framelimit + 1):
    
    # action for animation

    frame = frame + 1
    ops.render.render(animation=True)

and maybe someone can tell me how i can stop python rendering without closing the console or blender.
wich shortcut do i have to use in the terminal in windows, mac and linux?

No time to look at it deep but I think your code must be this way:

Scene.frame_start=1
Scene.frame_end=250
ops.render.render(animation=True)

So you must first load start and end frames in the appropriate blender variables and then call the render for animation only one time.

I have no idea of keys to stop the rendering, I would try Escape, Ctrl+Z, Ctrl+C.

By the way, if you call blender in a terminal:
blender --help
it prints the blender help
you can see ways of calling blender without needing python.
blender -s 1 -e 250 -a is perhaps what you want? (not tested if I am using the correct sintaxys, look at the help to know).

hallo bao2,

thanks for your reply.
i the above script, i missed some code here is the complete code:

from bpy import *
from random import *

framelimit = 250
frame = 1

while frame < (framelimit + 1):

    context.scene.frame_start = frame
    context.scene.frame_end = frame

    # action for animation

    frame = frame + 1
    ops.render.render(animation=True)

before every rendering i tell blender which is the start and end frame.

I see.
I think ops.render.render(animation=True) renders from start to end frames BOTH INCLUSIVE so it is rendered two times.

Try not using the animation one but the frame one instead:

from bpy import *
from random import *

framelimit = 250
frame = 1

context.scene.frame_start = frame
context.scene.frame_end = framelimit

while frame < (framelimit + 1):

     context.scene.frame_current = frame

     # action for animation

     frame = frame + 1
     ops.render.render()

edit:

first i thought that is is working but it isnt.
if i do it like mentioned above, frames get rendered corectly one after another, but my python wich changes the object dont works. i will try some combinations of the script.
the old script rendered the first fram and the next with same informations, so they look the same, and then the second image got overwritten with the first image of the next cycle with two similar images.
hope you can understand what i mean.

Could you create a very very very simple scene that is not working. Just a cube and also change your script to very very basic but yet not working. Upload to pasteall.org for example if you don’t have other better way and say step by step what must be done to see the error and what would be the correct thing blender to do.

“glow” is speaking about his python for changing the objects during
the animation. There is no such thing for blender 2.5x.
If he uses the python-thing put in evaluation of a python-driver,
this is only calculated at the end of the animation and is only
used at the next frame.
Maybe this is the reason he dont sees any results of his
python-script.
@glow: if you use some python to change your objects
for some frame-ranges, you should put the call
into your render-loop and your script should use
the frame-numbers from this looping.

I hope you get what i want to say …?

hey together,

i have it. you have to set the end frame before the start frame.
and then it works. if set the start frame first blender adds 1 to the end frame so that it renders from 1-2 instead of 1-1.
thanks for your replys.

from bpy import *
from random import *

framelimit = 250
frame = 1

while frame < (framelimit + 1):

    context.scene.frame_end = frame
    context.scene.frame_start = frame
    
    # action for animation

    frame = frame + 1
    ops.render.render(animation=True)

Thanks for posting the solution. Very interesting.