1

I downloaded the pynput on my mac(running Big Sur) with

pip install pynput

nd when I run the code, VSCode show the error:

Unable to import 'pynput.keyboard'pylint(import-error)

Here is my code:

from pynput.keyboard import Key, Listener
import logging

log_dir = ""

logging.basicConfig(filename=(log_dir + "keylogs.txt"), level=logging.DEBUG, format='%(asctime)s: %(message)s')

def on_press(key):
    logging.info(str(key))

with Listener(on_press=on_press) as Listener:
    Listener.join()
vandit vasa
  • 413
  • 4
  • 20

0 Answers0