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 摘要。