title: Paramiko: no tty present and no askpass program specified ssh python
body: <p>New to Python:</p>
  
  <p>I have below block of code that is supposed to loop on remote hosts. </p>
  
  <pre><code>    import paramiko
      ssh = paramiko.SSHClient()
      ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
      ssh.load_system_host_keys()
      ssh.connect(host, 22, username, password, timeout=5)
      stdin, stdout, stderr = ssh.exec_command('sudo hostname')
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>sudo: no tty present and no askpass program specified
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>stdin, stdout, stderr = ssh.exec_command('sudo -S hostname')
  </code></pre>
  
  <p>AND </p>
  
  <pre><code>stdin, stdout, stderr = ssh.exec_command('sudo hostname',  get_pty=True)
  </code></pre>
  
  <p>But the code is getting stock forever (not working). </p>
  
  <p>Any suggestions?</p>