def testAnimation():

  scn = bpy.context.scene
  arm = bpy.data.armatures["Rig"]
  rigobj = bpy.data.objects["Rig"]
  scn.objects.active = rigobj
  rigobj.select = True

  bpy.ops.object.mode_set(mode = 'POSE')

  boneSelect = bpy.context.object.data.bones['RThigh']
  boneSelect.select = True

  bpy.ops.transform.rotate(value=(0), axis=(1.0,1.0,1.0))
  boneSelect.keyframe_insert(data_path = "location", frame = 0.0)

  bpy.ops.transform.rotate(value=(math.pi*0.5), axis=(6.0,80.0,40.0))
  boneSelect.keyframe_insert(data_path = "location", frame = 100.0)

  bpy.ops.transform.rotate(value=(math.pi*0.5), axis=(1.0,0.0,0.0))
  boneSelect.keyframe_insert(data_path = "location", frame = 200.0)


I have tried placing many variables in data_path, but it comes up with a TypeError. What should I place in my data_path for it to take the new transformation?

Thank you for your time.


1 Answer 1


You need .pose in your path, like this:


This is because the Edit bones and the Pose bones have separate data while sharing some common attributes.

  • $\begingroup$ Thank you very much for solving my issue and clarifying it for me. $\endgroup$
    – The Intern
    Jul 3, 2014 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .