title: Python/Parimiko error: FileNotFoundError: [Errno 2] No such file
body: <p>I have the following script:</p>
  
  <pre><code>import pysftp as sftp
  
  def sftp_send():
      try:
          s = sftp.Connection(host='****', username='****', password='****')
      remotepath = '/var/sftp/uploads'
      localpath='ds/test.txt'
      s.put(localpath, remotepath)
      s.close()
  
  except Exception as e:
      raise e
  
  sftp_send()
  </code></pre>
  
  <p>When run it throws a "No such file" error. When I change the 'localpath' variable to:</p>
  
  <pre><code>localpath = 'ds' 
  </code></pre>
  
  <p>it returns a 'ds is a directory', so it identifies the path up until this point. However once I add the filename, the above error occurs. I've looked at a couple of similar questions which recommended looking at remote/local permissions, however there doesn't seem to be one conclusive answer. Any ideas?</p>