Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting the entire output from subprocess.Popen
    primarykey
    data
    text
    <p>I'm getting a slightly weird result from calling subprocess.Popen that I suspect has a lot to do with me being brand-new to Python.</p> <pre><code>args = [ 'cscript', '%USERPROFILE%\\tools\\jslint.js','%USERPROFILE%\\tools\\jslint.js' ] p = Popen(args, stdout=PIPE, shell=True).communicate()[0] </code></pre> <p>Results in output like the following (the trailing double \r\n is there in case it's important)</p> <pre><code>Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\n </code></pre> <p>If I run that command from an interactive Python shell it looks like this</p> <pre><code>&gt;&gt;&gt; args = ['cscript', '%USERPROFILE%\\tools\\jslint.js', '%USERPROFILE%\\tools\jslint.js'] &gt;&gt;&gt; p = subprocess.Popen(args, stdout=subprocess.PIPE, shell=True).communicate()[0] Lint at line 5631 character 17: Unexpected /*member 'OpenTextFile'. f = fso.OpenTextFile(WScript.Arguments(0), 1), ... Lint at line 5649 character 17: Unexpected /*member 'Quit'. WScript.Quit(1); </code></pre> <p>So there's all the output I really care about, but if I dump the value of the "p" variable I just set up...</p> <pre><code>&gt;&gt;&gt; p 'Microsoft (R) Windows Script Host Version 5.8\r\nCopyright (C) Microsoft Corpor ation. All rights reserved.\r\n\r\n' &gt;&gt;&gt; </code></pre> <p>Where'd all that data I want end up going? It definitely didn't end up in "p". Looks like it's going to stdout, but I didn't I explictly tell it not to do that?</p> <p>I'm running this on Windows 7 x64 with Python 2.6.6</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload