import pipes
from subprocess import Popen, PIPE
cmd = ['ssh', self.host, 'cat > ' + pipes.quote(out_path)]
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate(in_string)
подпроцесс python зависает