Open git-iason opened 1 year ago
everything works if i follow the suggestion here: https://github.com/moses-palmer/pynput/issues/55#issuecomment-924820627
it looks like a fix was put in place at one point, but reverrted here? https://github.com/moses-palmer/pynput/commit/0c0c9b3df06df2770f9af798003e0c61086a5ec4
Thank you for your report.
The fix was put in place since the cause of the issue was a race condition in pyobjc
, which was supposedly fixed in version 8 of that library. 0c0c9b3df06df2770f9af798003e0c61086a5ec4 is part of a set of commits where one is an update to pyobjc 8.0. Does that specific version work for you?
Same error for pynput 1.7.6 and 1.7.5 with pyobjc 8.0
Rolling back to pynput 1.7.4 gives isssues with ctypes... but that might be because im on python 3.10...
For everyone coming here and still has an issue even with pyobjc==9
, please try waiting until one listener is started to start the other.
import pynput
listener = pynput.keyboard.Listener(
on_press=self.keyboardEventCallbackHelperPressed,
on_release=self.keyboardEventCallbackHelperReleased
)
mouse_listener = pynput.mouse.Listener(
on_click=self.mouseEventCallback,
on_scroll=self.mouseEventCallback
)
keyboard_listener.start()
keyboard_listener.wait()
print("Keyboard event listener started")
mouse_listener.start()
mouse_listener.wait()
print("Mouse event listener started")
Description
Test on macos version 11.7, starting both mouse and keyboard listener throws this error:
Platform and pynput version
MacOs 11.7, pynput 1.7.6, pyobjc 8.5.0 To Reproduce
sample broken code