Skip to content

Commit a68a72a

Browse files
committed
input argument checking
1 parent 5394156 commit a68a72a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plotly/offline/offline.py

+10
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ def plot(figure_or_data,
230230
web browser after saving.
231231
This argument only applies if `output_type` is 'file'.
232232
"""
233+
if output_type not in ['div', 'file']:
234+
raise ValueError(
235+
"`output_type` argument must be 'div' or 'file'. "
236+
"You supplied `" + output_type + "``")
237+
if not filename.endswith('.html') and output_type == 'file':
238+
warnings.warn(
239+
"Your filename `" + filename + "` didn't end with .html. "
240+
"Adding .html to the end of your file.")
241+
filename += '.html'
242+
233243
plot_html, plotdivid, width, height = _plot_html(
234244
figure_or_data, show_link, link_text, validate,
235245
'100%', '100%')

0 commit comments

Comments
 (0)