Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault on macOS #619

Open
jeanCarloMachado opened this issue Oct 30, 2023 · 5 comments
Open

Segmentation Fault on macOS #619

jeanCarloMachado opened this issue Oct 30, 2023 · 5 comments

Comments

@jeanCarloMachado
Copy link

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!

@qent
Copy link

qent commented Nov 23, 2023

same trouble

@destroy314
Copy link

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

@Nelson-Gon
Copy link

Yep, this breaks MacOS

@Catyre
Copy link

Catyre commented Dec 25, 2023

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

@amannirala13
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants