title: Paramiko "TypeError: 'NoneType' object is not callable" at the end of a script that execute command on the server
body: <p>I'm writing a script to execute commands in an EC2 instance, and come back. For that, I'm using Paramiko. My script is like this:</p>
  <pre><code>ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh.connect('&lt;hostname&gt;', username='&lt;username&gt;', password='&lt;password&gt;')
  print('connected')
  stdin, stdout, stderr = ssh.exec_command(&quot;ls -lah&quot;)
  ssh.close()
  print('done')
  </code></pre>
  <p>The trace I'm getting is:</p>
  <pre class="lang-none prettyprint-override"><code>connected
  done
  Exception ignored in: &lt;function BufferedFile.__del__ at 0x7fa5de814950&gt;
  Traceback (most recent call last):
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/file.py&quot;, line 66, in __del__
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/channel.py&quot;, line 1392, in close
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/channel.py&quot;, line 991, in shutdown_write
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/channel.py&quot;, line 963, in shutdown
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/channel.py&quot;, line 1246, in _send_eof
    File &quot;/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/message.py&quot;, line 232, in add_int
  TypeError: 'NoneType' object is not callable
  </code></pre>
  <p>The command which I use to login is:</p>
  <pre><code>ssh -o PubkeyAuthentication=no -l &lt;username&gt; &lt;hostname&gt;
  </code></pre>
  <p>Can someone tell me what I'm doing wrong here?</p>