Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[BUG]: Unnecessary `UserWarning` when using `fig.write_image()` with `kaleido.start_sync_server()`

未关闭 适合新手
#5,786 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python

调研方向

从 plotly/io/_kaleido.py 中第 185 行附近的 kaleido.calc_fig_sync() 调用开始,然后跟踪 fig.write_image() 如何构造其参数。使用 kaleido.start_sync_server() 重现该示例,并确认在未提供任何 Kaleido 选项时不会出现警告,同时对于已提供的选项,现有的警告行为仍然保持不变。

由索引模型根据 Issue 内容生成。

描述

bug
Description

When using kaleido.start_sync_server(), fig.write_image() emits a UserWarning on every call, even though no kopts are specified.
The warning is:

plotly\io\_kaleido.py:185: UserWarning: The kopts argument is ignored if using a server.
  img_bytes = kaleido.calc_fig_sync(

The image is generated successfully, but since no kopts are specified, it seems that this warning should not be emitted.

It looks like Plotly passes kopts to kaleido.calc_fig_sync() even when no Kaleido options are specified.

Would it be possible for Plotly to avoid passing kopts when no Kaleido options were specified, or otherwise avoid this warning in this case?

Steps to reproduce
import plotly.express as px
import kaleido

fig = px.line(x=[0, 1], y=[0, 1])

kaleido.start_sync_server()
fig.write_image("a.png")  # success, but UserWarning
kaleido.stop_sync_server()
Notes
  • plotly 7.1.0
  • kaleido 1.4.0
主要语言
Python
星标
18.8k
派生
2.9k
平均合并
14 小时 12 分钟
30 天内合并 PR
19

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

plotly/plotly.py 的其他 Issue

查看 plotly/plotly.py 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。