title: Python 'subprocess' CalledProcessError: Command '[...]' returned non-zero exit status 1
body: <p>Executing the following script...</p>
  
  <pre><code>import socket                   
  import sys                          
  
  from collections import OrderedDict
  from subprocess import check_output
  from threading import Thread    
  </code></pre>
  
  <p>[...]</p>
  
  <pre><code>class IpCheck(Thread):  
  
      RECEIVED_PACKAGES_RE = re.compile(r'(\d+) received')
  
      def __init__(self, ip):                         
          Thread.__init__(self)
          self.ip = ip
          self.result = None
  
      def run(self):                          
          match = self.RECEIVED_PACKAGES_RE.search(
              check_output(['ping', '-q', '-c2', '-W1', self.ip])
          )
  
          successful_ping_count = int(match.group(1)) if match else 0
  
          if successful_ping_count == 0:
              self.result = 'no response'
          elif successful_ping_count == 1:
              self.result = 'alive, but 50% package loss'
          elif successful_ping_count == 2:
              self.result = check_snmp(self.ip)
          else:
              assert False
  
  [...]
  </code></pre>
  
  <p>... results in an error:</p>
  
  <blockquote>
    <p>CalledProcessError: Command '[ping', '-q', '-c2', '-W1', '10.81.3.80 ']'   returned non-zero exit status 1</p>
  </blockquote>
  
  <p>Adding "stderr = STDOUT" in <code>check_output</code> did not produce any useful feedback.  </p>
  
  <p>How can I obtain more information regarding the error so that I can troubleshoot it?</p>