title: Paramiko SFTPClient.get fails with "FileNotFoundError: [Errno 2] No such file or directory" referring to the remote file path
body: <p>I am trying to use Paramiko to get a log file from my Raspberry Pi:</p>
  <pre><code>import paramiko
  paramiko.util.log_to_file(&quot;paramiko.log&quot;)
  
  # Open a transport
  host, port = RECV_IP_ADDRESS, 22
  transport = paramiko.Transport((host, port))
  
  # Auth
  username, password = &quot;pi&quot;, &quot;raspberry&quot;
  transport.connect(None, username, password)
  # Go!
  sftp = paramiko.SFTPClient.from_transport(transport)
  # Download
  filepath = &quot;/&quot;
  localpath = &quot;/home/pi/Code/log.txt&quot;
  sftp.get(filepath, localpath)
  
  # Close
  if sftp: sftp.close()
  if transport: transport.close()
  </code></pre>
  <p>However when I run this program I get a file not found error:</p>
  <blockquote>
  <p>FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/Code/log.txt'</p>
  </blockquote>
  <p>Clearly the file is here</p>
  <pre><code>po@raspberrypi:~/Code $ pwd
  /home/pi/Code
  po@raspberrypi:~/Code $ ls
  a.out  log.txt  test.c
  po@raspberrypi:~/Code $ _
  </code></pre>
  <p><a href="https://i.stack.imgur.com/tHksO.png" rel="nofollow noreferrer">(terminal screenshot)</a></p>
  <p>But the program can't seem to find it.</p>
  <p>I had thought that perhaps the connection had died. I tried a suggestion found here:<br />
  <a href="https://stackoverflow.com/questions/28288533/check-if-paramiko-ssh-connection-is-still-alive">Check if paramiko ssh connection is still alive</a></p>
  <pre><code>transport.send_ignore()
  </code></pre>
  <p>Did not yield an error.</p>
  <p>I am new to Paramiko. Do I need to run something on the Pi in order for this to work? Is it not simply a wrapper for SFTP/SSH?</p>