Apr-03-2019, 03:00 PM
I'm setting up a keylogger for my mac OS to track esports reaction times. Most of the code is fine, with pynput installed successfully and the code seeming to check out, however when I go to run the code in Visual studio code (my text editor) i get the error:
'can't open file '.logger.pyw': [Errno 2] No such file or directory'
can anyone help me with this? i'm quite new to python so i'm sure its a simple fix i've not done!
My python code is:
'can't open file '.logger.pyw': [Errno 2] No such file or directory'
can anyone help me with this? i'm quite new to python so i'm sure its a simple fix i've not done!
My python code is:
from pynput.keyboard import Key, Listener #vanilla import logging #make a log file log_dir = "" logging.basicConfig(filename=(log_dir + "key_log.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s:') def on_press(key): logging.info(str(key)) #if key == Key.esc: #stop listener #return false with Listener(on_press=on_press) as listener: listener.join()And my terminal is:
PS /Users/dav3javu/Desktop/keylogger/pynput-master> python3 .logger.pyw /Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app /Contents/MacOS/Python: can't open file '.logger.pyw': [Errno 2] No such file or directory