title: sftp.get python paramiko [no such file]
body: <p>I'm writing a Python script that needs to download a remote xml file to parse it.</p>
  <p>I'm using paramiko for it.</p>
  <p>Here is the script:</p>
  <pre><code>def copyFile(ip, user, pwd, remotePath, localPath):
      ssh = paramiko.SSHClient()
      ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
      try:
          ssh.connect(ip,username=user,password=pwd)
          ### Copy remote file to server        
          sftp = ssh.open_sftp()
          sftp.get(remotePath,localPath)
          sftp.close()
          ssh.close()
          return [&quot;OK&quot;,0,0]
      except IOError as e:
          flash(str(e)+&quot; IOERROR&quot;)
          return [&quot;IOERROR: &quot; + str(e),0,0]
      except Exception as e:
          flash(str(e)+&quot; OTHER EXCEPTION&quot;)
          return [&quot;Error: &quot; + str(e),0,0]
  </code></pre>
  <p>The code returns and IOError saying that the file don't exists.</p>
  <p>But If I swap the variable for strings, it works perfectly.:</p>
  <pre><code>   `sftp.get(&quot;/etc/conf/file-cfg.xml&quot;,&quot;./conf/file-cfg.xml&quot;)` 
  </code></pre>
  <p>The variables are being passed correctly:</p>
  <pre><code>    `copyFile(ip,username,pwd,&quot;/etc/conf/&quot;+i,&quot;.&quot;+i)`
  </code></pre>
  <p>I lost a lot of time trying to figure out whats is wrong withou any success.</p>
  <p>My remote machine : Ubuntu 13.10 x64
  Local Machine: Windows 7 x64</p>