Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.038 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'builtin': 0.09; 'subject:()': 0.09; 'subject:command': 0.09; 'cc:addr:python- list': 0.11; 'stderr': 0.16; 'subject: \n ': 0.16; 'subject:which': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'command': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'case.': 0.24; 'cc:2**0': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(maybe': 0.31; 'at:': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'most': 0.60; 'august': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'subject:. ': 0.67; 'url:a': 0.72; 'execution.': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=g2IK3N8/79+RKV6fAqAbDInx/M7cNu1ntlac1Au7Ahg=; b=PJOAxwpAZrpxDkPJlFpN2v/Xh73DzOCZRDpEaT1Rcoq80PEHPZeMsK3rg/gEJDqPCM +I20IzjP/ixeG+IU+wMaVkUUpew6W4R2Vq0V53J+cxuJEyk0gRP/CjXT/ylU24DjgMru VBjI8torrycU+LUWTi7iAQ3JiyjELRUNj7Yt3j7hCR1N8gBU37pEfhS/aAyuNwinKOSn buh+yUNF4Zfw5k/gW8db3Tx+OH9GIj9w6uNURsAMycpWil45yVaBS2M4NGf21678PlO6 ExqVqNmqAzKtdLCG/+DkXQMCJgEOORIUZBpmekEYoYVQuyhxu6SQxUfNS4pKjeqZjOd7 lXBQ== X-Received: by 10.152.4.232 with SMTP id n8mr9321447lan.29.1376215882155; Sun, 11 Aug 2013 03:11:22 -0700 (PDT) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: References: From: Joshua Landau Date: Sun, 11 Aug 2013 11:10:42 +0100 X-Google-Sender-Auth: 45tiTIkOZ4A66NkyBNo_3cpnuGw Subject: Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient() To: Chris Angelico Content-Type: text/plain; charset=UTF-8 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376215889 news.xs4all.nl 15982 [2001:888:2000:d::a6]:34042 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52377 On 11 August 2013 09:57, Chris Angelico wrote: > On Thu, Aug 8, 2013 at 8:20 AM, sagar varule 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.