Skip to content

Commit 57ec19f

Browse files
authored
Be more forgiving when anything with opening a webbrowser fails
1 parent 956ab2c commit 57ec19f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/python/plotly/plotly/io/_renderers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,14 @@ def show(fig, renderer=None, validate=True, **kwargs):
525525
else:
526526
# If ipython isn't available, try to display figures in the default
527527
# browser
528-
import webbrowser
529-
530528
try:
529+
import webbrowser
531530
webbrowser.get()
532531
default_renderer = "browser"
533-
except webbrowser.Error:
534-
# Default browser could not be loaded
532+
except Exception:
533+
# Many things could have gone wrong
534+
# There could not be a webbrowser Python module,
535+
# or the module may be a dumb placeholder
535536
pass
536537

537538
renderers.render_on_display = True

0 commit comments

Comments
 (0)