Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

Joshua Landau joshua at landau.ws
Sun Aug 11 06:10:42 EDT 2013


On 11 August 2013 09:57, Chris Angelico <rosuav at gmail.com> wrote:
> On Thu, Aug 8, 2013 at 8:20 AM, sagar varule <sagar.varule at gmail.com> wrote:
>>  stdin, stdout, stderr = client.exec_command(bv_cmd)
>>             for line in stderr.readlines():
>>                 print line
>>             for line in stdout.readlines():
>>                 print line
>> But problem here is client.exec_command(bv_cmd) waits for command to execute completely and then it returns to stdout,stderr. And I want to see the ouput from the command during its execution. Because my command takes long time for execution.
>
> Are you certain that exec_command is what's waiting, and not readlines()?

That's a very good catch;

Sagar, you might want to look at:
http://stackoverflow.com/a/4896288/1763356
for a good solution if this is the case. There might be more builtin
ways (maybe select.select) but I'm betting that link's the most
rigorous.



More information about the Python-list mailing list