pio.write_image not working from within flask route
还没有人认领这个 Issue。
评估
调研方向
从提供的 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 小时
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/kaleido 的其他 Issue
-
Writing to an existing directory whose name has a dot fails with "Invalid format"可能已有人在做 @RaphaelFakhri 于 14 天前认领。 未关闭bug P3 size: 1
难度 2/5 1-3 小时 新手友好度 35/100
-
Deterministic Rendering Challenges可能重新可做 @camdecoster 于 68 天前认领,目前没有进行中的 PR。 未关闭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 一周以上 新手友好度 25/100
-
GlobalKaleidoServer is not thread-safe可能已有人在做 @talleibman 于 250 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
相似的 Issue
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 77/100
githubnext/gh-aw-workshop#5367 ·
维护者通常 3 天内回复
-
Create Noise Latents ignores randomize_seed and produces the same noise every run可能已有人在做 @griptapeops 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
griptape-ai/griptape-nodes-library-diffusers#127 ·
维护者通常 1 天内回复
-
Jenkins capacity report: metrics history is lost when archiving a month fails可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
adoptium/infrastructure#4568 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
huggingface/deep-rl-class#723 ·
-
premises-missing
难度 2/5 1-3 小时 新手友好度 78/100
WingedGuardian/GENesis-AGI#3928 ·
维护者通常 1 天内回复