title: passing commands to PUTTY
body: <p>I use the following code to open putty terminal and pass a command. The terminal opens fine, but further nothing happens. The script just stops until I close the terminal. What could cause a problem here?  </p>
  
  <pre><code>import subprocess, time
  test=subprocess.Popen('"C:\Program Files (x86)\PuTTY\putty.exe" -ssh -X -I
          p:\.ssh\id_dsa.ppk my_name@my_host', 
          stdin=subprocess.PIPE,
          stdout=subprocess.PIPE)
  test.stdin.write("ls\n")
  test.stdin.flush()
  test.stdin.close()
  stdout_value = test.stdout.read()
  print repr(stdout_value)
  print 'done'
  </code></pre>