I'm trying to make a simple keylogger using Python2.7 and am getting a SyntaxError for this piece of code:
def OnKeyboardEvent(event):
logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s'
chr(event.Ascii)
logging.log(10,chr(event.Ascii))
return True
Once I type this it says invalid Syntax and highlights the chr next to `(event.Ascii)
If you can answer this THANK YOU!
(PS in the preview the code was set up line by line correctly)
Oliver W.
13.6k3 gold badges41 silver badges52 bronze badges
-
When I properly formatted your question (use 4 spaces before code when posting on stackoverflow) the reason it gives you a Syntaxerror becomes apparent immediately. Check the end of the previous line for a missing parentheses. I suggest to use an editor with builtin syntax highlighting to see these mistakes easily.Oliver W.– Oliver W.2015年04月06日 00:21:15 +00:00Commented Apr 6, 2015 at 0:21
1 Answer 1
def OnKeyboardEvent(event):
logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s') # missing )
chr(event.Ascii)
answered Apr 6, 2015 at 0:24
JGerulskis
8084 gold badges11 silver badges24 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py