Skip to content

Commit 8220663

Browse files
committed
safer imports
1 parent 96cf0db commit 8220663

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plotly/offline/offline.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ def plot():
169169

170170
try:
171171
_init_notebook_mode()
172-
except (PlotlyOfflineNotFound, ImportError):
172+
except:
173173
# No big deal. The user just hasn't called download_plotlyjs yet.
174174
# Only bubble up the PlotlyOfflineNotFound error when they attempt
175175
# to create a plot and don't have the source files.
176+
# Since this is run on every `import plotly`, catch all of the errors
177+
# here - we'll bubble up the errors in `iplot` if the user intends on
178+
# using offline mode. Otherwise, no sense in erroring on running a
179+
# a function that the user wasn't even going to run.
176180
pass

0 commit comments

Comments
 (0)