Skip to content

Commit 07a2ab3

Browse files
authored
Fix JavaScript "Error: addFrames failure" in offline html export (#1152)
* Fix JavaScript `Error: addFrames failure` in offline html export
1 parent 756660a commit 07a2ab3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: plotly/offline/offline.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@ def _plot_html(figure_or_data, config, validate, default_width,
174174
jdata = _json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder)
175175
jlayout = _json.dumps(figure.get('layout', {}),
176176
cls=utils.PlotlyJSONEncoder)
177-
if 'frames' in figure_or_data:
178-
jframes = _json.dumps(figure.get('frames', {}),
177+
178+
if figure.get('frames', None):
179+
jframes = _json.dumps(figure.get('frames', []),
179180
cls=utils.PlotlyJSONEncoder)
181+
else:
182+
jframes = None
180183

181184
configkeys = (
182185
'staticPlot',
@@ -229,7 +232,7 @@ def _plot_html(figure_or_data, config, validate, default_width,
229232
config['linkText'] = link_text
230233
jconfig = jconfig.replace('Export to plot.ly', link_text)
231234

232-
if 'frames' in figure_or_data:
235+
if jframes:
233236
script = '''
234237
Plotly.plot(
235238
'{id}',

0 commit comments

Comments
 (0)