Skip to content

Commit b87f752

Browse files
committed
use k.calc_fig() instead of k.write_fig() in pio.full_figure_for_development()
1 parent 60bb748 commit b87f752

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

plotly/io/_kaleido.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,11 @@ def full_figure_for_development(fig, warn=True, as_dict=False):
313313

314314
if kaleido_major > 0:
315315
# Kaleido v1
316-
try:
317-
json_file = Path(tempfile.mkstemp(suffix=".json")[1])
318-
kaleido.write_fig_sync(
319-
fig,
320-
json_file,
321-
dict(format="json"),
322-
)
323-
with open(json_file, "r") as f:
324-
fig = json.load(f)
325-
finally:
326-
# Cleanup: remove temp file
327-
json_file.unlink()
316+
bytes = kaleido.calc_fig_sync(
317+
fig,
318+
opts=dict(format="json"),
319+
)
320+
fig = json.loads(bytes.decode("utf-8"))
328321
else:
329322
# Kaleido v0
330323
fig = json.loads(scope.transform(fig, format="json").decode("utf-8"))

0 commit comments

Comments
 (0)