title: Error when saving Matplotlib Animation
body: <p>I've tried to save a Matplotlib animation, but am getting an odd error. The snippet of (I believe) relevant code is:</p>
  
  <pre><code>  def showMovie(self):
      frameFnc = self.getNoisyImage
      initFnc =  self.initImage
  
      movie = animation.FuncAnimation(self.movieFig, frameFnc,
                                  frames = len(self.noiseArrays),
                                  init_func = initFnc,
                                  interval=1, blit=True,
                                  repeat = True)
  
  
      movie.save("test.mp4", fps=10, extra_args=['-vcodec', 'libx264'])
      print "Saved movie"
      plt.ion()
      plt.show()
  
  
  
  if __name__ == '__main__':
      z = noiseTester()
      z.makeStaticNoiseImages()
      z.readPredList()
      z.showMovie()
  </code></pre>
  
  <p>The error I get is as follows:</p>
  
  <pre><code>Traceback (most recent call last):
    File "noiseTest6.py", line 134, in &lt;module&gt;
      z.showMovie()
    File "noiseTest6.py", line 123, in showMovie
      movie.save("test.mp4", fps=10, extra_args=['-vcodec', 'libx264'])
    File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 718, in save
      writer.grab_frame(**savefig_kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 204, in grab_frame
      dpi=self.dpi, **savefig_kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1421, in savefig
      self.canvas.print_figure(*args, **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 2220, in print_figure
  **kwargs)
    File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line 497, in print_raw
      renderer._renderer.write_rgba(filename_or_obj)
    RuntimeError: Error writing to file
  </code></pre>
  
  <p>When I check, <strong>filename_or_obj</strong> is an <strong>', mode 'wb' at 0x7f3de99164b0></strong>. This variable also has a <strong>name</strong> attribute, with a value of <strong>''</strong>. The meaning of this string value, instead of the name I tried to assign to the file is not clear to me.</p>
  
  <p>I know my animation is OK, because I've seen it work. It only has 500 frames, so I don't think it's too large. If anyone has any ideas about how I should chase down this Runtime error, I'd really appreciate it.</p>