diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index ad3db64b5280..e12b7829b07b 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -1544,7 +1544,6 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, # used if we don't know how many frames there will be: in the case # of no generator or in the case of a callable. self.save_count = save_count - # Set up a function that creates a new iterable when needed. If nothing # is passed in for frames, just use itertools.count, which will just # keep counting from 0. A callable passed in for frames is assumed to @@ -1562,9 +1561,15 @@ def __init__(self, fig, func, frames=None, init_func=None, fargs=None, self._iter_gen = lambda: iter(xrange(frames)) self.save_count = frames - # If we're passed in and using the default, set it to 100. + # If we're passed in and using the default, set save_count to 100. + # itertools.islice can return an error when passed a numpy int instead + # of a native python int. This is a known issue: + # http://bugs.python.org/issue30537 + # As a workaround, convert save_count to native python int if self.save_count is None: self.save_count = 100 + else: + self.save_count = int(self.save_count) self._init_func = init_func