No output from subprocess.check_output()
python, subprocess
Solution
This is supposed to work, but it's possible that the actual command you're running (presumably not `ls`) is buggy and sending all of its output to `stderr` instead of `stdout`. Try
output = subprocess.check_output(commandList, stderr=subprocess.STDOUT)
Problem
I'm trying to run the following code in Python 2.7.5: ``` output = subprocess.check_output(commandList) print (len(output)) ``` My command list is a list of arguments like: ['ls', '-l']. But then I get that the length of output is 0 even when I have a very long output string. The check_output though works correctly because I can see the result of the process running in the stdout (console). The ideal use case would be to run the subprocess, hide the stdout (nothing seen in the console), parse the output string and extract some relevant information.