title: Using subprocess.check_output for a command with 2>/dev/null
body: <p>I am on Mac OS X Yosemite 10.10 and Python 2.7. </p>
  
  <p>If I type the following: <code>du -g -d1 /Users 2&gt; /dev/null</code> in the command line, everything works perfectly.</p>
  
  <p>Now, my goal is to use that command in a python script.</p>
  
  <p>My idea was to use the following: </p>
  
  <pre><code>import subprocess
  
  output = subprocess.check_output(['du', '-g', '-d1', '/Users', '/dev/null'])
  </code></pre>
  
  <p>But I get this error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "./verifications.py", line 1, in &lt;module&gt;
      output = subprocess.check_output(['du', '-g', '-d1', '/Users', '/dev/null'])
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 537, in check_output
      raise CalledProcessError(retcode, cmd, output=output)
  subprocess.CalledProcessError: Command '['du', '-g', '-d1', '/Users', '/dev/null']' returned non-zero exit status 1
  </code></pre>
  
  <p>Also, when I run <code>subprocess.check_output(['du', '-g', '-d1', '/Users', '/dev/null'])</code> in local everything works fine, the error happens when I am logged on a shared iMac using Apple's Shared Screen tool. I have a feeling that the problem might be due to permissions, but I cannot find anything.</p>