![]() The program uses full buffering in a pipe. You'll hit a brick wall with this approach if That means you'll need aīackground thread to get around readline blocking (select only worksįor sockets on Windows). Manually handling the stdin/stdout pipes. If you need an interactive, stateful session, then communicate() won't Probably the source of the lockup you're getting. Otherwise plink leaves the console stdin in an unusable state. I had to add stdin=subprocess.PIPE when trying this interactively. Result = subprocess.check_output(cmd, stdin=subprocess.PIPE) Get the result using check_output (it sets up and callsĬmd = You just have a single command, it's simpler to have the ssh clientĮxecute it. To use communicate(), you need to set one or more of the standard Than None in the result tuple, you need to give stdout=PIPE and/or Note that if you want to send data to the process's stdin, you need toĬreate the Popen object with stdin=PIPE. Process, or None, if no data should be sent to the child. The optional input argument should be a string to be sent to the child """ Interact with process: Send data to stdin. Note, I am not familiar with subprocess so YMMV.Īn SSH module which help a lot with all of this. Should probably pass in a pipe so that you can send data more than This suggests communicate is waiting for the plink to end? Also, you ![]() Similarly, to get anything other than None in the result tuple, you need to give stdout=PIPE and/or stderr=PIPE too. Note that if you want to send data to the process's stdin, you need to create the Popen object with stdin=PIPE. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.Ĭommunicate() returns a tuple (stdoutdata, stderrdata). Read data from stdout and stderr, until end-of-file is reached. That being said, maybe this post will help:Īlso take a look at the municate documentation as I recommend usingĪn SSH module which help a lot with all of this. I am not familiar with plink, so I cannot help you. This time I'm using "plink" under Putty.Ĭmd = "plink -ssh -l ufuk10.10.10.10 -pw password" Securities, accuracy and completeness of information, viruses,Ĭonfidentiality, legal privilege, and legal entity disclaimers, This email is confidential and subject to important disclaimers andĬonditions including on offers for the purchase or sale of If you need to control Putty specifically then I cannot help. To install Paramiko if you are using Python 3. They are Python 2.x but you shouldīe able to use Paramiko in 3.x except for SFTP. ![]() Party module such as Fabric (which relies on Paramiko). If all you need to SSH then I would recommend using a 3rd How canĭo you need to control Putty or just SSH to another computer? Command = '"c:\Program Files\Putty\putty.exe" -sshīut then I want to input new commands to this Putty new window.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |