Create and render default scene without Blender GUI, linux shell

I am able to use python to do all kinds of things to a scene/objects/meshes within blender, but what I want for my ‘hello world’ example is to write a python script which is executed from the linux shell, it loads the default scene, renders it, writes it to disk and quits. So after running the script there is a .png image of the cube. Where should I start here?

http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Command_Line

Thank you for the link Richard. It is very helpful and I’m pretty close. Right now my version of blender on debian is 2.49 sub2. Is this the current version or should I install the latest tarball? (I have been using apt-get) It’s seg faulting when I try and render a blend from 2.69 and it must be a version issue. But I’m not worried much about that.

Now this shell command is perfect if I have the blend all ready to go, but I’m still wondering how to have a python script create a blend on the fly, from nothing. For right now I don’t even care ,I can hard code the filename and make it a parameter later. Basically a script called createblend.py that:

  1. Creates a new blend file
  2. Loads the default scene
  3. Saves it
  4. Closes

Once I have that I can render it using the command from the wiki. Any ideas? Thank you.

If anyone has any clues on this please share. Any high or low level advice is greatly appreciated. I’m not afraid to dive into dna and such but if there is some library I could use to abstract it that would be great. I don’t need a full explanation or solution just a few hints. Thanks.

Bump.