Skip to content

Commit e7b7bc9

Browse files
committed
Fixed missed Wine pygrabber import in utils
1 parent 23ce3f3 commit e7b7bc9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import win32gui
2929
import win32ui
30-
from pygrabber.dshow_graph import FilterGraph
30+
import winerror
3131

3232
type STARTUPINFO = subprocess.STARTUPINFO
3333
else:
@@ -175,6 +175,13 @@ def get_window_bounds(hwnd: int) -> tuple[int, int, int, int]:
175175
def get_input_device_resolution(index: int) -> tuple[int, int] | None:
176176
if sys.platform != "win32":
177177
return (0, 0)
178+
try:
179+
from pygrabber.dshow_graph import FilterGraph # noqa: PLC0415
180+
except OSError as exception:
181+
# wine can choke on D3D Device Enumeration if missing directshow
182+
if exception.winerror != winerror.TYPE_E_CANTLOADLIBRARY:
183+
raise
184+
return None
178185
filter_graph = FilterGraph()
179186
try:
180187
filter_graph.add_video_input_device(index)

0 commit comments

Comments
 (0)