viveca
04/12/2023, 3:45 PMfig.write_html()
. So I made a simple custom dataset
class PlotlyHTMLDataSet(JSONDataSet):
"""Export plotly figure to html"""
def _save(self, data: go.Figure) -> None:
save_path = get_filepath_str(self._get_save_path(), self._protocol)
with self._fs.open(save_path, **self._fs_open_args_save) as fs_file:
data.write_html(fs_file, **self._save_args)
self._invalidate_cache()
This worked fine… except the content-type of the html file on s3 “ends up” being “binary/octet-stream”, but should be “text/html”. This becomes a problem when trying to display this in a browser. Anyone got experience of args you could pass here to manually set the content type? Not my area of expertise.
Thanks,
Vivecadatajoely
04/12/2023, 4:26 PMself._fs.open(…
try adding mode: 'wt'
so you’re writing text not binaryviveca
04/12/2023, 4:54 PMdatajoely
04/13/2023, 7:57 AMmode
and encoding
(which only applies to text)utf-8
to encoding is what you need to coerce it in to a text formatviveca
05/05/2023, 3:59 PM