Issuing commands using "exec_command()" of paramiko AND also sending commands together

Sreenathan Nair sreenath.cg at gmail.com
Wed Jun 3 03:07:40 EDT 2015


Hi,

Could you be more specific about your problem? Perhaps an example of
something similar to what you're trying to do would be helpful.

Usually the process is to instantiate paramiko.SSHCLIENT, use the connect()
method with desired parameters and execute commands using the
exec_command(). If you'd like to process the output of the command
execution, then you would store the result of exec_command() into three
variables (it return a 3-tuple of Channel objects).

i.e com_stdin, com_stdout, com_stderr =
my_ssh_client_instance.exec_command("<command>")

The instance of SSHCLIENT is live until the close() method is called.
Meaning subsequent commands can be executed the same way.


On Wed, Jun 3, 2015 at 8:07 AM, Pythonista <kukki.kanchana at gmail.com> wrote:

> Using paramiko's exec_command(), i would like to send a command, process
> its output and do it for several other commands. I notice that its not
> quick enough or something like that.
>
> How would I handle that scenario AND also providing multiple commands
> together (there is 1 post on stackoverflow for issuing multiple commands
> but I am not sure if someone has tried it. It didnt work for me!
>
> Thanks!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150603/a4ca3dec/attachment.html>


More information about the Python-list mailing list