After converting a Plotly graph to an HTML Page by this code:
import plotly
import plotly.express as px
df = px.data.stocks()
fig = px.line(df, x='date', y="GOOG")
plotly.offline.plot(fig , filename = 'filename.html', auto_open=False)
How can I store this HTML Page on an S3 bucket?
I tried this code:
fig.write_html('testPage.html', auto_play=False)
But I’m getting this error:
Read-only file system: 'testPage.html'
2
Answers
To get the latest code examples of all AWS SDKs, including Python, look at the new AWS Code Library here:
https://docs.aws.amazon.com/code-library/latest/ug/what-is-code-library.html
You will find hundreds of code examples in many different programming languages. Included in this doc is how to perform Amazon S3 operations using the AWS SDK for Python.
The Code Library is not the old Code Catelog – its the replacement.
UPDATE
Your code to upload an object using Python SDK is here:
https://docs.aws.amazon.com/code-library/latest/ug/python_3_s3_code_examples.html
See this topic.
Assuming you are running this into a lambda:
Make sure the lambda has the right permission in place to upload the file into the s3 bucket.