I have this code which should simulate a key press, but it is not working and I don't know why. My IDE has access to monitor input to the keyboard in system preferences. When I use keyboard.type("sentence")
it works but does not type the first two characters. I am very confused as to why. Any help is appreciated
import time
from pynput.keyboard import Key, Controller
keyboard = Controller()
time.sleep(2)
keyboard.press('a')
keyboard.release('a')
Does your IDE have the permission: system preferences/Security & Privacy/Accessibilty? (macOS)