title: Object Location Change on Blender Python
body: <p>I was following an animation example with Python in Blender 2.69, by typing a line by line.</p>
  
  <pre><code>obj = bpy.context.object
  obj.location[2] = 0.0
  obj.keyframe_insert(data_path="location", frame=10.0, index=2)
  obj.location[2] = 1.0
  obj.keyframe_insert(data_path="location", frame=20.0, index=2)
  </code></pre>
  
  <p>But I have encountered an error on the 3rd line, which is saying</p>
  
  <pre><code>Traceback (most recent call last):
  File "&lt;blender_console&gt;", line 1, in &lt;module&gt;
  AttributeError: 'NoneType' object has no attribute 'location'
  </code></pre>
  
  <p>I am confused because I just followed a simple example.</p>
  
  <p>Why is it saying the object has no attribute 'location'?</p>
  
  <p>I'll be appreciated for your help, thanks.</p>