You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
This morning I was using keyboard.Listener in a small python program and everything worked. I upgraded to the latest xcode (Version 15.0 (15A240d) and let it finishing installing new frameworks for ios and macos development and key presses no longer get to the listener, instead they are echoed to the console.
I also restarted the computer after installing xcode -- so it's possible Apple applied one of it's invisible security updates. I have those enabled. Actual OS updates have to ask me.
Am very curious if this issue arises for anybody else.
Platform and pynput version
Your operating system and version, and the version of pynput.
macos 13.5.2, pynput 1.7.6, python 3.11.5
To Reproduce
If possible, please include a short standalone code sample that reproduces the bug. Remember to surround it with code block markers to maintain indentation!
Code sample extracted from larger program:
# https://pynput.readthedocs.io/en/latest/keyboard.html
from pynput import keyboard
running = True
def on_press(key):
global running
try:
match key:
case key.up:
print("arrow-up")
case key.right:
print("arrow-right")
case key.down:
print("arrow-down")
case key.left:
print("arrow-left")
case key.enter | key.esc:
print("enter or esc")
running = False
return False
except AttributeError:
running = False
return False
def on_release(key):
pass
listener = keyboard.Listener(
on_press=on_press, on_release=on_release)
listener.start()
print("\nPress arrows to adjust, enter or esc to quit\n")
def main():
while running:
pass
main()
This morning it worked fine.
Now pressing the left and right arrow keys and Enter results in output like this and I have to press ctrl-C to quit the program.
% python3 simple-keyboard.py
Press arrows to adjust, enter or esc to quit
^[[C^[[C^[[D^[[D
Steps that didn't work:
Added the following Python to Security and Preferences list of programs that have access to Accessibility features (this is the Python that is running when the simple-keyboard program is running):
Could it be that the update included pyobjc? I unfortunately no longer have access to a macOS system, but I think some version of pyobjc is included with some Apple product. You can check this by importing Quartz in your script and checking its __file__ attribute. It should come from your virtualenv.
Description
This morning I was using
keyboard.Listener
in a small python program and everything worked. I upgraded to the latest xcode (Version 15.0 (15A240d) and let it finishing installing new frameworks for ios and macos development and key presses no longer get to the listener, instead they are echoed to the console.I also restarted the computer after installing xcode -- so it's possible Apple applied one of it's invisible security updates. I have those enabled. Actual OS updates have to ask me.
Am very curious if this issue arises for anybody else.
Platform and pynput version
Your operating system and version, and the version of pynput.
macos 13.5.2, pynput 1.7.6, python 3.11.5
To Reproduce
If possible, please include a short standalone code sample that reproduces the bug. Remember to surround it with code block markers to maintain indentation!
Code sample extracted from larger program:
This morning it worked fine.
Now pressing the left and right arrow keys and
Enter
results in output like this and I have to pressctrl-C
to quit the program.Steps that didn't work:
Added the following Python to Security and Preferences list of programs that have access to Accessibility features (this is the Python that is running when the simple-keyboard program is running):
Running with
sudo
:Removing
suppress=True
makes no difference in the results.The text was updated successfully, but these errors were encountered: