asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

X protocol error when trying to write and press #744

Closed TaokyleYT closed 1 year ago

TaokyleYT commented 1 year ago

I will show all code related to this first import pyautogui as k keys = [ ' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~' ] for prin in keys: k.write(prin) k.press(‘execute’)

and than when I run it it keep showing

X protocol error: <class ‘Xlin.error.BadValue’>: code = 2, resource_id = 0, sequence_number = 15, major_opcode = 133, minor_opcode = 2

anyone know why

TaokyleYT commented 1 year ago

Ok so it turns out pyautogui.press(‘execute’) actually is the problem It seems that the ‘execute’ key is not accepted for some reason