<div dir="ltr">Hello,<div><br></div><div>I changed my way. This time I'm using "plink" under Putty.</div><div><br></div><div>My python code is:</div><div><br></div><div><div>os.chdir("c:\\Program Files\\Putty")</div>
<div>cmd = "plink -ssh -l ufuk10.10.10.10 -pw password"</div><div>process = subprocess.Popen(cmd)</div><div>inputdata="r van"</div><div>result = process.communicate(inputdata)</div><div><br></div><div>
But after the successful SSH, I cannot continue, no command runs:</div><div>This is the new output after the initial SSH connection:<br></div><div>No data input.</div><div><br></div><div><div>Last login: Fri Dec 21 16:27:</div>
<div>ufuk@home-ubuntu:~$</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/20 Prasad, Ramit <span dir="ltr"><<a href="mailto:ramit.prasad@jpmorgan.com" target="_blank">ramit.prasad@jpmorgan.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">Ufuk Eskici wrote:<br>
> Hello,<br>
><br>
> I run this command and opens putty:<br>
><br>
> import os<br>
> import subprocess<br>
> command = '"c:\Program Files\Putty\putty.exe" -ssh <a href="mailto:ufukeskici@10.10.10.10">ufukeskici@10.10.10.10</a> -pw test<br>
> subprocess.Popen(command)<br>
><br>
> But then I want to input new commands to this Putty new window. How can I do it?<br>
><br>
<br>
</div></div>Do you need to control Putty or just SSH to another computer?<br>
If all you need to SSH then I would recommend using a 3rd<br>
party module such as Fabric (which relies on Paramiko). Those modules<br>
will simply SSH significantly. They are Python 2.x but you should<br>
be able to use Paramiko in 3.x except for SFTP. This link might help<br>
to install Paramiko if you are using Python 3. <a href="https://github.com/paramiko/paramiko/issues/16" target="_blank">https://github.com/paramiko/paramiko/issues/16</a><br>
<br>
If you need to control Putty specifically then I cannot help.<br>
<br>
<br>
Ramit<br>
<br>
<br>
This email is confidential and subject to important disclaimers and<br>
conditions including on offers for the purchase or sale of<br>
securities, accuracy and completeness of information, viruses,<br>
confidentiality, legal privilege, and legal entity disclaimers,<br>
available at <a href="http://www.jpmorgan.com/pages/disclosures/email" target="_blank">http://www.jpmorgan.com/pages/disclosures/email</a>.<br>
</blockquote></div><br></div>