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

Sign up
Appearance settings
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit a49a913

Browse files
Add try/except
1 parent d296f0f commit a49a913

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

‎lib/matplotlib/_plotly_helpers.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ class Plotly:
77

88
@classmethod
99
def save(cls, fig):
10-
plot = tools.mpl_to_plotly(fig)
11-
json = plot.to_json()
12-
timestamp = datetime.utcnow()
13-
file = open("plots/{}.html".format(timestamp), "w")
14-
file.write(json)
15-
file.close()
10+
try:
11+
plot = tools.mpl_to_plotly(fig)
12+
json = plot.to_json()
13+
timestamp = datetime.utcnow()
14+
file = open("plots/{}.html".format(timestamp), "w")
15+
file.write(json)
16+
file.close()
17+
except:
18+
print('An error occurred while writing the plot to JSON.')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /