I am doing a big animation project and I need to use a python script to do it. As a first test to understand how it works. I am using this script found here blender script

import Blender
from Blender import *
from Blender.Scene import Render

scn = Blender.Scene.Get("Scene")     
context = scn.getRenderingContext()

context.extensions = True
context.renderPath = "c:\\temp"
context.imageType = Render.TARGA
context.fps = 25
context.sFrame = 1       
context.eFrame = 100         


to execute this script, i used this command

blender --background --python runblender.py

I got this error:

Traceback (most recent call last):  
File "/Users/xxx/Desktop/pythonscript/runblender.py", line 1, in <module>
    import Blender
ImportError: No module named 'Blender'

Blender quit

If you are using Blender 2.5 onwards, it doesn't have a Blender module, the script you are trying to run was written for 2.49 or lower.

The equivalent script for Blender 2.7+ would be something like:

import bpy

c = bpy.context.scene
r = c.render

r.use_file_extension = True
r.filepath = 'c:\\temp'

#Set PAL 16:9 settings manually
r.resolution_x = 720
r.resolution_y = 576
r.pixel_aspect_x = 16
r.pixel_aspect_y = 11

r.image_settings.file_format = 'TARGA'
r.fps = 25
c.frame_start = 1       
c.frame_end = 100         

  • $\begingroup$ Thanks, you were too fast! I saw the question, wrote it up and came back and yours was already there! : ) $\endgroup$ Jun 19 '15 at 16:08
  • $\begingroup$ I am using mac os x. I just changed the path r.filepath = '/Users/xxx/folder/'. I have not any error but also I have not any rendered image. $\endgroup$ Jun 19 '15 at 16:32
  • $\begingroup$ Sorry, the last line should be set to output animation frames. I've updated the line. $\endgroup$ Jun 19 '15 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.