Skip to content

Commit 9220d8e

Browse files
committed
Tolerate errors in svg2png or plot
1 parent c099c3c commit 9220d8e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

mathicsscript/format.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ def eval_boxes(result, fn, obj, **options):
6464
temp_png = NamedTemporaryFile(
6565
mode="w+b", suffix=".png", prefix="mathicsscript-"
6666
)
67-
svg2png(bytestring=svg_str, write_to=temp_png.name)
68-
plt.axes().set_axis_off()
69-
img = mpimg.imread(temp_png)
70-
plt.imshow(img)
71-
plt.show()
72-
temp_png.close()
67+
try:
68+
svg2png(bytestring=svg_str, write_to=temp_png.name)
69+
plt.axes().set_axis_off()
70+
img = mpimg.imread(temp_png)
71+
plt.imshow(img)
72+
plt.show()
73+
temp_png.close()
74+
except: # noqa
75+
pass
7376
return expr_type
7477

7578
if format == "text":

0 commit comments

Comments
 (0)