something weird is happening.
In short explanation - my .py file gets deleted automatically when I use pynput
lib
Detailed explanation -
I create a file called keylog.py
I have installed ->pip install pynput
,
when I run the code:
import logging
logging.basicConfig(filename=("keylog.txt"), level=logging.DEBUG, format=" %(asctime)s - %(message)s")
def onPress(key):
logging.info(str(key))
Everything is ok.
But when I add:
# from pynput.keyboard import Key, Listener
import logging
logging.basicConfig(filename=("keylog.txt"), level=logging.DEBUG, format=" %(asctime)s - %(message)s")
def onPress(key):
logging.info(str(key))
# with Listener(on_press=onPress) as listener:
# listener.join()
Even if the pynput import is commented out the keylog.py
file gets deleted automatically.
I have no idea why this happen, I tried to delete PyCharm and re-install, I tried working in VScode, same thing happening.
I didn't configure something special.
I would like some help and explanation why this happen, Thanks.