Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when using matplotlib animation

Trying to make an animation using example code found here. I have installed both ffmpeg and yasm, but when I run the code, including the line

ani.save('test.mp4', writer = FFwriter, dpi = 40)

I get the following error.

PermissionError: [Errno 13] Permission denied

(where FFwriter = animation.FFMpegWriter(fps = 30) is defined in the beginning of my Jupyter doc). I have tried so much, but can't get anything to work. Even tried changing the permissions of ffmpeg but still can't get the error to go away.

EDIT Here is my imports and such to include more detail

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/Cellar/ffmpeg/'
FFwriter = animation.FFMpegWriter(fps = 30)
like image 288
Nate Stemen Avatar asked Apr 26 '26 16:04

Nate Stemen


1 Answers

You do not have permission to save in your working directory. Either write a full filepath to a place where you do have permission or run your script with sudo so that you do have permission.

like image 138
Michael Avatar answered Apr 28 '26 06:04

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!