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


Groups > comp.lang.python > #73810

Success with subprocess communicate on Windows?

From Terry Reedy <tjreedy@udel.edu>
Subject Success with subprocess communicate on Windows?
Date 2014-07-01 17:05 -0400
Newsgroups comp.lang.python
Message-ID <mailman.11386.1404248789.18130.python-list@python.org> (permalink)

Show all headers | View raw


I am mentoring a GSOC student, Saimadhav Heblikar, who is working on 
adding the following feature to Idle: submit the editor text to an 
external program, such as pyflakes, and display the result in an 
OutputWindow. If it reports line numbers with problems, as pyflakes 
does, users will be able to jump to the line in the file (this exists 
already for multiple-file grep output).

The 'obvious' implementation is to use subprocess.Open.communicate to 
run the process and capture the output. The prototype code at 
http://bugs.python.org/issue21880 works on linux. The key part of the 
new code at http://bugs.python.org/file35819/3rdpartychecker-v2.diff is

+from subprocess import Popen, PIPE
...
+            proc = Popen(args, stdout=PIPE, stderr=PIPE)
+            proc.wait()
+            output, error = map(lambda b:b.decode('utf-8'), 
proc.communicate())

It does not work on Windows. As I reported on 
http://bugs.python.org/issue8631, msg222053,
 >>> subprocess.check_output("pyflakes -h")
works in the interpreter and Idle shell, while
 >>> s.check_output("pyflakes c:\programs\python34\lib\turtle.py")
gives bizarre output in the interpreter and hangs in the idle shell, as 
does the code above.

My question is whether anyone reading that has had success getting 
subprocess output capture to work consistently on Windows?

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextNext 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