How to save Animation.Artist animation?

I have a problem:

My program works well, but when I try to save the animation I'm drawing, the compiler responds to an error.

The code:

import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.animation as animation fig=plt.figure() for infile in glob.glob('*.png'): img=mpimg.imread(infile) imgplot=plt.imshow(img) im_list2.append([imgplot]) ani = animation.ArtistAnimation(fig, im_list2, interval=50, blit=True) 

But when I try to save it like this:

 ani.save('Animation1.mp4') 

It returns an error:

WindowsError: [Error 2] The system could not find the data.

+1
python matplotlib windows-xp
source share
1 answer

I think you have the same problem that I had a few days ago: here is the question I posted!

I solved my problem by changing line 163 from C: \ Python27 \ Lib \ site-packages \ matplotlib \ animation.py from

 proc = Popen(command, shell=False, stdout=PIPE, stderr=PIPE) 

to

 proc = Popen(command, shell=True, stdout=PIPE, stderr=PIPE) 

... However, I'm not sure how safe this change is in the animation.py file! See here for more details .

+2
source share

All Articles