Skip to content

Commit b794153

Browse files
authored
Catch pywintypes.error in broadcast manager (#1659)
1 parent f3fa071 commit b794153

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

can/broadcastmanager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# try to import win32event for event-based cyclic send task (needs the pywin32 package)
2323
USE_WINDOWS_EVENTS = False
2424
try:
25+
import pywintypes
2526
import win32event
2627

2728
# Python 3.11 provides a more precise sleep implementation on Windows, so this is not necessary.
@@ -263,7 +264,7 @@ def __init__(
263264
win32event.CREATE_WAITABLE_TIMER_HIGH_RESOLUTION,
264265
win32event.TIMER_ALL_ACCESS,
265266
)
266-
except (AttributeError, OSError):
267+
except (AttributeError, OSError, pywintypes.error):
267268
self.event = win32event.CreateWaitableTimer(None, False, None)
268269

269270
self.start()

0 commit comments

Comments
 (0)