Rendering in background mode

Hi guys,

I have some Problems with Blender’s background mode.
I created a script that generates a 3D scene and an animation. Now I want to render this scene in two ways:

  1. just some “random” frames as png
  2. the whole animation

It’s working great when I use a normal command like blender -P, but when I use blender -b -P it crashes with the following error:

15618 Segmentation fault LD_LIBRARY_PATH=/opt/python2.5.2/lib:$LD_LIBRARY_PATH /opt/blender2.46/blender $*

I was looking for the line that let Blender crash and I found it:

This is the code:

        context = Scene.GetCurrent().getRenderingContext();

        for i in range(0, len(self.__preview_frames)): 
            frame = self.__preview_frames[i];
            context.extensions = True;
            context.renderPath = self.__path;
            context.imageType = Scene.Render.PNG;
            context.sFrame = frame;
            context.eFrame = frame;

And here’s my question:
Is it possible to render images or animations in backround mode via scripts with renderAnim()?

I hope somebody can help me with this problem. Thanks.