Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!81.171.88.16.MISMATCH!hq-usenetpeers!hq-usenetpeers.eweka.nl!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Windows': 0.02; 'string.': 0.05; 'args': 0.07; 'url:msdn': 0.07; 'string': 0.09; 'arguments': 0.09; 'executable': 0.09; 'exit': 0.09; 'explanation': 0.09; 'imply': 0.09; 'null,': 0.09; 'parameter': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'windows': 0.15; 'extension,': 0.16; 'extension.': 0.16; 'idle,': 0.16; 'interpreter,': 0.16; 'quoted': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'sequence.': 0.16; 'url:85)': 0.16; 'url:aspx)': 0.16; 'url:windows': 0.16; 'wrote:': 0.18; 'module': 0.19; 'seems': 0.21; 'command': 0.22; 'header:User-Agent:1': 0.23; 'specifies': 0.24; '(see': 0.26; 'extension': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'tim': 0.29; 'gather': 0.31; 'quotes': 0.31; 'searches': 0.31; 'file': 0.32; 'probably': 0.32; 'skip:c 30': 0.32; 'says': 0.33; 'period': 0.33; 'sense': 0.34; 'subject:with': 0.35; 'but': 0.35; 'add': 0.35; 'subject:?': 0.36; 'url:microsoft': 0.37; 'ends': 0.38; 'url:library': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'first': 0.61; 'name': 0.63; 'therefore,': 0.64; 'url:en-us': 0.68; 'default': 0.69; 'url:%1': 0.72; 'behavior': 0.77; '100%': 0.77; '.com': 0.84; 'whereas': 0.91; '8bit%:18': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Wolfgang Maier Subject: Re: Success with subprocess communicate on Windows? Date: Wed, 02 Jul 2014 19:31:44 +0200 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: bio-192-52-34-153.mobile.uni-freiburg.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; 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: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404322328 news.xs4all.nl 2864 [2001:888:2000:d::a6]:45572 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 5459 X-Received-Body-CRC: 2710176778 Xref: csiph.com comp.lang.python:73842 On 02.07.2014 11:05, Terry Reedy wrote: > On 7/2/2014 12:33 AM, Tim Roberts wrote: >> Terry Reedy wrote: >> >> 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. > I am not 100% sure whether that is the problem, but from what I gather from the subprocess module docs the args string is passed to the Windows CreateProcess function as a single string. To me this seems to imply that it is passed as the lpCommandLine parameter (with Null for the lpApplicationName parameter). This is what Microsoft says about this case (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx): If lpApplicationName is NULL, the first white space–delimited token of the command line specifies the module name. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter). If the file name does not contain an extension, .exe is appended. Therefore, if the file name extension is .com, this parameter must include the .com extension. If the file name ends in a period (.) with no extension, or if the file name contains a path, .exe is not appended. If the file name does not contain a directory path, the system searches for the executable file in the following sequence. So in your case the default behavior would be to add an .exe extension to pyflakes, which is probably not what you intended ? Best, Wolfgang