无法将 Plotly 图表保存到 HTML 文件

Unable to save Plotly chart to a HTML file

我试图将绘图图表另存为 HTML 文件,但收到错误消息 Access to the file was deniedThe file at file:///Users/Documents/notebooks/figure.html is not readable. It may have been removed, moved or file permissions may be preventing access.

html 文件没有保存。我正在使用 Brave 浏览器,不确定它们是否相关。

示例代码

import plotly.io as pio
import plotly.graph_objects as go
labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
values = [4500, 2500, 1053, 500]
fig = go.Figure(data=[go.Pie(labels=labels, values=values)])
fig.show()
pio.write_html(fig, file='figure.html', auto_open=True)

将浏览器切换到 Safari 后问题已解决。

我一直在使用这个图 HTML 成功,它适用于我尝试过的所有浏览器。不可否认,我还没有尝试过 'auto-open'.

fig.write_html("C:/???/???/Desktop/Port.html")