title: Paramiko stdout readline() command hangs
body: <p>I am using the the python paramiko library to SSH into a FTP server. I am able to use the command line to access the server and retrieve a list of files using the sftp command, however paramiko seems to be doing something that prevents me from retrieving output. Here is my python code:</p>
  
  <pre><code>import paramiko
  client = paramiko.SSHClient()
  
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  
  client.connect('###########',
          port=##,
          username='####',
          password='####',
          key_filename='#####')
  
  stdin, stdout, stderr = client.exec_command('ls')
  </code></pre>
  
  <p>this all works just fine. However the next line</p>
  
  <pre><code>stdout.readline()
  </code></pre>
  
  <p>just sits there and hangs. Notice that per <a href="https://stackoverflow.com/questions/35266753/paramiko-python-module-hangs-at-stdout-read">this thread</a> I am not even trying to retrieve the full output, just the first line.</p>
  
  <p>I also tried</p>
  
  <pre><code>stdin.close()
  print(stdout.readlines())
  </code></pre>
  
  <p>which returns an empty string. This suggests that maybe the server is waiting for input, but when I use the command line I am able to just send the ls command and get the output so what command could it be waiting for?</p>
  
  <p>Versions:</p>
  
  <ul>
  <li>python 3.7.4</li>
  <li>paramiko 2.7.1</li>
  </ul>