Specify path of savefig with pylab or matplotlib
For matplotlib.pyplot, the error FileNotFoundError: [Errno 2] No such file or directory
can occur due to nonexistence of the containing folder ../MyDocs/resource/frames/
.
So maybe first create the folder
import os
os.makedirs('../MyDocs/resource/frames/')
then rerun the savefig function.
The tilde operator and the variable $HOME
are entered as strings and therefore do not function while saving. You have to provide either relative path (as you did) or provide the full path. Eg. pylab.savefig("/home/username/Desktop/myfig.png")
.