Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 4d21c9b

Browse files
author
Takeshi Ikuma (LSUHSC)
committed
plugins must return None if not compatible
1 parent 4b6c75f commit 4d21c9b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ffmpegio_plugin_mpl/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def video_info(obj: Figure) -> Tuple[Tuple[int, int, int], str]:
1919
:return: shape (height,width,4) and data type "|u1" (rgba)
2020
:rtype: Tuple[Tuple[int, int, int], str]
2121
"""
22-
return (int(obj.bbox.bounds[3]), int(obj.bbox.bounds[2]), 4), "|u1"
22+
try:
23+
return (int(obj.bbox.bounds[3]), int(obj.bbox.bounds[2]), 4), "|u1"
24+
except:
25+
return None
2326

2427

2528
@hookimpl
@@ -32,7 +35,11 @@ def video_bytes(obj: Figure) -> memoryview:
3235
:rtype: memoryview
3336
"""
3437

35-
with io.BytesIO() as io_buf:
36-
obj.savefig(io_buf, format="raw")
37-
io_buf.seek(0)
38-
return io_buf.getvalue()
38+
try:
39+
with io.BytesIO() as io_buf:
40+
obj.savefig(io_buf, format="raw")
41+
io_buf.seek(0)
42+
return io_buf.getvalue()
43+
except:
44+
None
45+

0 commit comments

Comments
 (0)