2012-02-13 41 views
1

我有一个问题:如何保存Animation.Artist动画?

我的程序运行良好,但是当我尝试保存我绘制的动画时,编译器响应一个错误。

验证码:

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) 

但是当我尝试将它保存这样的:

ani.save('Animation1.mp4') 

它返回一个错误:

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

+0

我提供了一个完整的小例子来展示问题,它会更容易回答。 – 2012-02-13 15:22:01

+0

如果你已经找到了你的问题的答案(如你对india_dourada答案的评论中给出的),你应该回答你自己的问题,并将其标记为已接受。 – bmu 2012-05-17 08:12:18

回答

2

我认为你是用相同的问题我几天前:here是我发布的问题!

我解决我的问题由c更改行163:\ Python27 \ LIB \站点包\ matplotlib \ animation.py从

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

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

...然而,我不确定animation.py文件中的这个变化有多“安全”! See more info here

+0

Thx Man,错误没有再显示,但没有保存:S任何想法??? – 2012-02-15 12:12:16

+0

就我而言,我没有任何意外的麻烦。我的动画被妥善保存在它应有的路径中。 你知道你在哪个目录下工作吗? 我建议你在脚本开头选择你的目录(例如,如果你有一个名为D:/ CG/DREAM的文件夹): 'os.chdir('D:/ CG/DREAM')' 然后,检查动画是否保存在这个文件夹中。 – carla 2012-02-15 18:09:23

+0

佩德罗,现在工作吗? – carla 2012-02-20 10:25:35