keyboard icon indicating copy to clipboard operation
keyboard copied to clipboard

Segmentation Fault on macOS

Open jeanCarloMachado opened this issue 1 year ago • 6 comments

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!

jeanCarloMachado avatar Oct 30 '23 20:10 jeanCarloMachado

same trouble

qent avatar Nov 23 '23 20:11 qent

I use python -X faulthandler to located file ".../keyboard/_darwinkeyboard.py", line 134 cause the Bus error 10 and just comment that line.

destroy314 avatar Nov 26 '23 16:11 destroy314

Yep, this breaks MacOS

Nelson-Gon avatar Dec 02 '23 14:12 Nelson-Gon

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

Catyre avatar Dec 25 '23 22:12 Catyre

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.

amannirala13 avatar Apr 11 '24 17:04 amannirala13