Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73886

Re: Success with subprocess communicate on Windows?

Date 2014-07-03 10:03 +0200
From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject Re: Success with subprocess communicate on Windows?
References <mailman.11386.1404248789.18130.python-list@python.org> <iq27r9p1gg7nampcd6rr0pftrshinm9oog@4ax.com> <lp0i1p$3gn$1@ger.gmane.org> <loom.20140703T005928-903@post.gmane.org> <lp2l1n$et6$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.11445.1404376403.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-01 17:05 -0400
  Re: Success with subprocess communicate on Windows? Tim Roberts <timr@probo.com> - 2014-07-01 21:33 -0700
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-02 05:05 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 19:31 +0200
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 19:37 +0200
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-02 19:14 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 23:22 +0000
    Re: Success with subprocess communicate on Windows? Ethan Furman <ethan@stoneleaf.us> - 2014-07-02 16:54 -0700
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-03 00:09 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-03 10:03 +0200
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-03 11:22 +0200

csiph-web