Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Windows': 0.02; 'interpreter': 0.05; 'output': 0.05; 'remaining': 0.07; 'exit': 0.09; 'exits': 0.09; 'explanation': 0.09; 'python': 0.11; 'doing:': 0.16; 'finishes': 0.16; 'hmm.': 0.16; 'idle,': 0.16; 'observations': 0.16; 'reedy': 0.16; 'sees': 0.16; 'status.': 0.16; 'stderr': 0.16; 'stdout': 0.16; 'traceback.': 0.16; 'wrote:': 0.18; 'slightly': 0.19; 'starts': 0.20; 'thanks.': 0.20; 'command': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'sends': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'tried': 0.27; 'am,': 0.29; "doesn't": 0.30; 'lines': 0.31; 'pipe': 0.31; 'received:132': 0.31; 'regular': 0.32; 'run': 0.32; 'running': 0.33; 'are:': 0.33; 'guess': 0.33; 'message.': 0.35; 'subject:with': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'add': 0.35; 'earth': 0.36; 'idle': 0.36; 'wishes,': 0.36; 'subject:?': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'eventually': 0.60; 'header:Return- path:1': 0.60; "you're": 0.61; 'hang': 0.67; '*and*': 0.84; 'gone.': 0.84; 'partial': 0.84 Delivery-date: Thu, 03 Jul 2014 10:33:21 +0200 Date: Thu, 03 Jul 2014 10:03:07 +0200 From: Wolfgang Maier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Terry Reedy , python-list@python.org Subject: Re: Success with subprocess communicate on Windows? References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404376403 news.xs4all.nl 2935 [2001:888:2000:d::a6]:40867 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73886 On 07/03/2014 06:09 AM, Terry Reedy wrote: > > Yes, but what puzzled me is that running > subprocess.check_output(r'pyflakes c:\programs\python34\lib') > in the regular interpreter *does* produce output instead of the error > message. My guess is that it fills up the pipe, so that check_output > starts reading the pipe long before pyflakes exits with status 1. > > Hmm. I tried it again, and I see some but not all of the output I got at > the command line *and* I see the exit status message. So the subprocess > must get some of the output but then stop when it sees the exit status. > Thanks. > For a partial explanation try this: from the command line (again my path is slightly different): pyflakes C:\Python34\lib > stdout.txt this will still give you a few lines of output and these should be the same ones you're seeing from the python interpreter when you're doing: subprocess.check_output(r'pyflakes C:\Python34\lib') ==> pyflakes sends these lines to stderr instead of stdout !! confirmation: subprocess.check_output(r'pyflakes C:\Python34\lib', stderr=subprocess.PIPE) and the output is gone. So the remaining questions are: - why on earth is pyflakes sending these lines (and only these) to stderr ? - what is happening to the stderr output when run in IDLE ? I guess it is caught and suppressed somewhere, but to add to your observations the check_output call doesn't hang on IDLE, but finishes eventually with no output other than the traceback. Best wishes, Wolfgang