title: Python Move a File from Remote Machine to Local
body: <p>I am new in python and trying different stuff.</p>
  
  <p>Currently trying to copy a text file <code>to_copy.txt</code> from a remote machine with local ip <code>192.168.1.101</code> to my current machine.</p>
  
  <p>What i tried from googling does not seem to work.</p>
  
  <pre><code>import paramiko
  from scp import SCPClient
  
  ssh = paramiko.SSHClient()
  ssh.load_system_host_keys()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh.connect("testme@192.168.1.101", password="look420")
  print("Connected")
  scp = SCPClient(ssh.get_transport())
  scp.get("/home/testme/target_folder/to_copy.txt")
  scp.close()
  </code></pre>
  
  <p>But, when i run this i get error;</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/uc/Python_Projects/MoveFileAndFolder/move_remote.py", line 7, in &lt;module&gt;
      ssh.connect("testme@192.168.1.101", password="look420")
    File "/usr/local/lib/python3.4/dist-packages/paramiko/client.py", line 296, in connect
      to_try = list(self._families_and_addresses(hostname, port))
    File "/usr/local/lib/python3.4/dist-packages/paramiko/client.py", line 200, in _families_and_addresses
      addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
    File "/usr/lib/python3.4/socket.py", line 530, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -2] Name or service not known
  </code></pre>
  
  <p>What i am doing wrong here?</p>
  
  <p><strong>NOTE:</strong> Current machine is running <code>Debian Jessie</code> and the remote machine runs <code>Ubuntu 14.04.4 LTS</code> </p>