title: How do I fix my Keylogger code to produce an output?
body: <p>I'm trying to make a keylogger script on python 2.7, followed some instructions on how to do so but mine didn't produce any output when I try running it and pressed some keys. Any idea how to fix it or what am I missing on my code? :/</p>
  
  <p>Here's the code:</p>
  
  <pre><code>import pynput
  
  from pynput.keyboard import Key, Listener
  
  
  def on_press(key):
      print("(0) pressed".format(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()
  </code></pre>