Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a68a72a

Browse filesBrowse files
committed
input argument checking
1 parent 5394156 commit a68a72a
Copy full SHA for a68a72a

File tree

1 file changed

+10
-0
lines changed
Filter options

1 file changed

+10
-0
lines changed

‎plotly/offline/offline.py

Copy file name to clipboardExpand all lines: plotly/offline/offline.py
+10Lines changed: 10 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.