title: Wait until task is completed on Remote Machine through Python
body: <p>I am writing a program in python on Ubuntu. In that program I am trying to print a message after completing a task "Delete a File" on Remote machine (RaspberryPi), connected to network.</p>
  
  <p>But In actual practice, print command is not waiting till completion of task on remote machine.</p>
  
  <p>Can anybody guide me on how do I do that?
  My Coding is given below</p>
  
  <pre><code>import paramiko
  
  # Connection with remote machine
  client = paramiko.SSHClient()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  client.connect('192.168.2.34', username='pi', password='raspberry')
  
  filename   = 'fahad.txt'
  filedelete ='rm ' + filename
  stdin, stdout, stderr = client.exec_command(filedelete)
  print ("File Deleted")
  client.close()
  </code></pre>