keyboard
keyboard copied to clipboard
Segmentation Fault on macOS
Hello Community,
Firstly, thank you for your hard work on this incredibly useful library. I've encountered an issue when using it on macOS that I'd like to report. I am experiencing a segmentation fault when I run the following code snippet:
import keyboard
keyboard.add_hotkey('caps lock', lambda: print("foo"))
keyboard.wait()
I get the following error message:
zsh: segmentation fault python3
I'm running this on a Mac. I've tried searching for similar issues but haven't come across a solution yet. Any guidance on this would be greatly appreciated.
Thanks in advance!
same trouble
I use python -X faulthandler
to located file ".../keyboard/_darwinkeyboard.py", line 134 cause the Bus error 10 and just comment that line.
Yep, this breaks MacOS
I use
python -X faulthandler
to located file ".../keyboard/_darwinkeyboard.py", line 134 cause the Bus error 10 and just comment that line.
# This breaks "import keyboard" on macOS Sonoma (M2)
Carbon.CFDataGetBytes(k_layout, CFRange(0, k_layout_size), ctypes.byref(k_layout_buffer))
Can confirm, just discovered this myself. Although I can import it fine now after commenting that line out, I'm not sure what side effects there would be down the road as I continue to use this library
I use
python -X faulthandler
to located file ".../keyboard/_darwinkeyboard.py", line 134 cause the Bus error 10 and just comment that line.
This works.