Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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; 'args': 0.07; 'string': 0.09; 'exit': 0.09; 'literal': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'idle,': 0.16; 'idle.': 0.16; 'interpreter,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'variables,': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'command': 0.22; 'header :User-Agent:1': 0.23; 'right.': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'url:bugs': 0.29; 'am,': 0.29; 'tim': 0.29; 'gives': 0.31; 'code': 0.31; 'that.': 0.31; 'quotes': 0.31; 'skip:c 30': 0.32; 'url:python': 0.33; 'sense': 0.34; 'could': 0.34; 'subject:with': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'there': 0.35; 'explains': 0.36; 'idle': 0.36; 'interaction': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'list': 0.37; 'problems': 0.38; 'window': 0.38; 'to:addr :python-list': 0.38; 'explain': 0.39; 'does': 0.39; 'bad': 0.39; 'received:71': 0.39; 'reported': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'here': 0.66; '(hint:': 0.84; 'received:fios.verizon.net': 0.84; 'remembering': 0.84; 'shell,': 0.91; 'whereas': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Success with subprocess communicate on Windows? Date: Wed, 02 Jul 2014 05:05:51 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-71-175-90-87.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404291980 news.xs4all.nl 2926 [2001:888:2000:d::a6]:48628 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73829 On 7/2/2014 12:33 AM, Tim Roberts wrote: > Terry Reedy wrote: >> >> 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. > > Right. What do you think \t is in a string? (Hint: it's only one byte.) Yes, how could I forget that. But my use of a string literal here does not explain the problems when used string variables, as generated by os. I should try printing out the list of args passed to subprocess. While remembering what \t is explains the command interpreter output (recursing through /lib), it does not explain the difference when invoked from Idle. There seems to be some bad interaction when calling subprocesses in the user subprocess. > You need to use > s.check_output("pyflakes c:\\programs\\python34\\lib\\turtle.py") > or > s.check_output(r"pyflakes c:\programs\python34\lib\turtle.py") Now I get "Command 'pyflakes c:\programs\python34\lib\turtle.py' returns non-zero exit status 1" on both. On Idle, as least, a command-prompt window is flashed/displayed. It makes no sense to me that in the command interpreter, 'pyflakes c:\\programs\\python34\\lib' works and 'pyflakes c:\\programs\\python34\\lib\\turtle.py' returns status 1. whereas both (with quotes elided and undoubled \) work at the command prompt. -- Terry Jan Reedy