Open AlexeyRogachenko opened 1 year ago
I'm getting this as well, when trying to register my first hotkey; given that this issue didn't come up on Google when I searched for the error, yet it was at the very top of the issues list w/ date 5 days ago, I'd maybe guess it's a recent thing..? Not sure.
Do you have M1 or Intel? I'm on:
Traceback (most recent call last):
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
Traceback (most recent call last):
File "/Users/tom/code_tmp/fields/play/selfimproving_clay/./scripts/hotkeys.py", line 7, in <module>
self.run()
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/threading.py", line 953, in run
keyboard.add_hotkey('ctrl+shift+r', hotkey_callback)
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 641, in add_hotkey
self._target(*self._args, **self._kwargs)
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 294, in listen
steps = parse_hotkey_combinations(hotkey)
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 573, in parse_hotkey_combinations
_os_keyboard.listen(self.direct_callback)
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/_darwinkeyboard.py", line 430, in listen
return tuple(tuple(combine_step(step)) for step in parse_hotkey(hotkey))
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 358, in parse_hotkey
raise OSError("Error 13 - Must be run as administrator")
OSError: Error 13 - Must be run as administrator
steps.append(tuple(key_to_scan_codes(key) for key in keys))
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 358, in <genexpr>
steps.append(tuple(key_to_scan_codes(key) for key in keys))
File "/Users/tom/.pyenv/versions/3.10.7/lib/python3.10/site-packages/keyboard/__init__.py", line 324, in key_to_scan_codes
raise ValueError('Key {} is not mapped to any known key.'.format(repr(key)), e)
ValueError: ("Key 't' is not mapped to any known key.", ValueError('Unrecognized character: t'))
Do you have M1 or Intel?
I'm on Macbook Pro M1, MacOS Ventura 13.3.1
Wonder if the apple silicon series is what's causing the issue (no idea really). I hope someone has some insight 'cause I'd love to use this package.
On the surface it looks to be a wonderful offering of multiplatform goodness. (I'd love to have a standardized form to express my keyboard remaps and such).
Looks like this project cannot map to your operating system keyboard layout. Use key codes as documented by your platform and directly send the numbers as shown in
keyboard.send(56)
If you find a module that wrote the key codes to their respective characters, use that. Otherwise find documentation like this
getting this error on keyboard.add_hotkey
too ,...
Got this problem too. A very old program of mine that worked previously broke when I tried running it now, probably something to do with recent system updates. Quite annoying.
@willywillycow @cornradio @Korolen @AlexeyRogachenko Maybe problem with Apple CPU, If you are using python(compile with apple arm), the key was not found. but, I install the python 3.8 (Intel version) and run by Rosetta2, It working again.... So, you can use the Rosetta Python to try again.
Hello! I know that macOS (osX) support is experimental, but it seems that my issue, if confirmed, would mean that there is little to no support of macOS at all.
So the issue is very simple. Any attemt to press and kind of letters ("w", "T" or others) lead to error as shown on the screenshot below
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/keyboard/__init__.py", line 379, in send
parsed = parse_hotkey(hotkey)
^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/keyboard/__init__.py", line 344, in parse_hotkey
scan_codes = key_to_scan_codes(hotkey)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/keyboard/__init__.py", line 324, in key_to_scan_codes
raise ValueError('Key {} is not mapped to any known key.'.format(repr(key)), e)
ValueError: ("Key 'w' is not mapped to any known key.", ValueError('Unrecognized character: w'))
UPD: Macbook Pro M1 MacOS Ventura 13.3.1 (a)