Python Error:NoneType Object is not iterable

I want to access shape keys thru python and give values, but I am stuck
Each time I want to run my script, I get the error NoneType Object is not iterable

Code:

#!BPY
import Blender
import sys
from Blender import *
ob1=Object.Get(“t1”).getData().getKey().getBlocks()
ob2=Object.Get(“t1”).getData().getKey().getIpo()
print “================================================”

print “Blocks:”,ob1
print “Ipos:”,ob2


I have created shape keys for my character.

I get lots of information in the ob1 ( Blocks) but None in the ob2?

not shure,
but to have “shapekeys” is not the same like to have “ipo”-curves.
You have to create animation-entries – for example for a
special shapekey you can animate the position - with key “i”
(insert a keyframe – and this autmatically creates an ipo-curve, if there is not already one for this kind of animation)

– and is the ipo-curve (from blender-2.4x) not always part of an “action”?

This is just python telling you that you need to test if your object is “None” before you proceed. You are making the mistake that the object you are referencing actually has shape keys. Even if it does, you still have to check.


if ob2 !=None:
  print (ob2)

Thanks Atom for your reply. I got the point. Its now doing.