CA Lee
09/19/2020, 11:08 AMplt.savefig
takes in a file_path
arg (below is some sample code):
CWD = os.path.dirname(os.path.abspath(__file__)) # Get CWD
file_path = os.path.join(CWD, "picture.png") # Save in CWD
plt.savefig(file_path)
This all works fine when I am running it on my server using flow.run()
, however, when it is registered on cloud, invoking a Quick Run results in the error : PermissionError: [Errno 13] Permission denied: '/picture.png'
The error shows that file_path
is unable to be parsed to the current working directory that the script is being run from when triggered from Cloud.
Would appreciate any insight.. if it helps, I am getting data from Google Sheets, plotting it and sending it to Slack, so I'd like to Prefect this workflow.nicholas
09/19/2020, 3:48 PMsudo
or as a user with access to that file?) but perhaps your agent/executor don't have those same permissions?CA Lee
09/20/2020, 9:57 AMflow.run()
, from within @task
):
os.path.dirname(os.path.abspath(__file__))
So the path resolves to just /'file_name'
.
Writing to the root folder /
is not allowed, hence PermissionError: [Errno 13]
.
The error is resolved when CWD gets called outside of @task