Create animation videos from 3D joint positions In continuation to the discussion to this question on Stackoverflow sambler suggested me to switch here since the questions got more Blender specific.

To sum up, I have to create a Human animation, given frame by frame 3D joint coordinates. Following the answer to my previous post, this is what I have done ->


Opened blender and deleted all the already present objects in it.
Created a new empty and named in 'myrig'
Ran the following code ->

import csv
import numpy as np
import bpy

mocap_data = {} # The mocapdata dictionary is properly created here, I checked that

scn = bpy.context.scene
objs = bpy.data.objects
rig = objs['myrig']

for m in mocap_data.keys():
    o = objs.new(m, None)
    scn.objects.link(o)
    c = rig.pose.bones[m].constraints.new('CHILD_OF') # Line 34
    c.target = o



I got the following error, 


  In line 34 - AttributeError: 'NoneType' object has no attribute
  'bones'


What went wrong? As I said in previous post, sorry for not understanding every aspect of the code but I am on a deadline right now. Thanks for the help.
You start with a blend file that contains a mesh which defines the appearance of your character. You then have an armature, which is made up of a collection of bones that deforms your character mesh. The armature is then used by an animator to control the position of the character during an animation.

The script you have takes a pre-recorded list of locations and automates the animation of the armature instead of someone manually animating it.

The line rig = objs['myrig'] is referring to the armature named 'myrig' that you have setup to deform your character, this needs to be an armature with bones matching the names in your mocap data, not an empty.