Saving and downloading gifs from matplotlib animation

Hi ,

I have been trying to use matplotlib animation to create a gif of photo frames for a given period and then save the gif so that i can all it later and display or download it somehow. The code I used works perfectly fine in a jupyter notebook, but here i seem to get an error message.

Please guide me how what I should do next…

I have uploaded the photos of the update funciton code and the saving code and the error message i receive.

Thank You