pio.write_image not working from within flask route
まだ誰も着手していません。
評価
調査の方向性
提供されている関数 saveScreenshot_2 から始め、Windows 10 上で Flask の route の内外で pio.write_image を再現します。Plotly 5.24.1 と Kaleido 0.2.1 を使用して動作を比較し、その後、ハングが route のコンテキストで発生しているのか、画像エクスポート呼び出しで発生しているのかを特定します。原因が特定され、検証済みの修正または明確な再現手順が文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am having an issue trying to store plotly image with command:
img = pio.write_image(fig=fig, file=fileName, format="png", width=800, height=500, scale=1, engine="kaleido")
It just hangs forever and cannot do anything.
I honestly do not know if this is plotly or kaleido issue. Funny thing is this only happens when within the Flask route. Same code works fine outside the route. For example, if I run this code:
def saveScreenshot_2(fig, width=800, height=500):
ic("def saveScreenShot_2")
"""Saves a Plotly figure as an image to a temporary file.
Args:
fig: The Plotly figure object.
width: The width of the image in pixels (default: 800).
height: The height of the image in pixels (default: 500).
Returns:
The path to the saved image file.
"""
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
try:
pio.write_image(fig=fig, format="png", file=temp_file.name, width=width, height=height, engine="kaleido")
ic("after pio.write_image")
return temp_file.name
except Exception as e:
print(f"Error saving image: {e}")
return None
outside the flask route, it works normally, but within flask route, it just hangs:
windows 10,
plotly.version: '5.24.1', kaleido.version: '0.2.1'
- 主要言語
- Python
- スター
- 504
- フォーク
- 65
- 平均マージ
- 6日 9時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/kaleido のほかの issue
-
Writing to an existing directory whose name has a dot fails with "Invalid format"対応中かも @RaphaelFakhri が 13 日前に担当しました。 オープンbug P3 size: 1
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
-
Deterministic Rendering Challenges再び着手できるかも @camdecoster が 68 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement feature P2 size: 5
-
[FEATURE]: Embed custom fonts into vector exports (no system install)対応中かも @camdecoster が 125 日前に担当しました。 オープンenhancement P3 size: 3
-
enhancement feature P3 size: 5
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
GlobalKaleidoServer is not thread-safe対応中かも @talleibman が 250 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
似ている issue
-
Server mode OAuth2: 'NoneType' object is not subscriptable on every request after re-submitting the OAuth2 login while already logged in対応中かも @Rarasinhoo が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
pgadmin-org/pgadmin4#10733 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws-samples/sample-per-model-bedrock#752 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
int-brain-lab/mpci#32 ·
-
area:docs priority:p2 type:docs
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jejjohnson/geostack#120 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
sublimelsp/LSP-vue#203 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信