title: How do I catch a subprocess.call error with Python?
body: <p>I'm trying to download a specific Docker image, where the user will input a version. However, if the version doesn't exist, Docker will throw an error.</p>
  
  <p>I'm using <code>subprocess.call</code> to pipe to the Terminal from Python 3. </p>
  
  <p>Sample code:</p>
  
  <pre><code>from subprocess import call
  containerName = input("Enter Docker container name: ")
  swVersion = input("Enter software version: ")
  
  call(["docker", "run", "--name", "{}".format(containerName), 
        "--detach", "--publish", "8080:8080", "user/software:{}".format(swVersion)])
  </code></pre>
  
  <p>If the version isn't found, docker will output in the Terminal: </p>
  
  <pre><code>docker: Error response from daemon: manifest for user/software:8712378 not found.
  </code></pre>
  
  <p>How do I catch this error within the Python script?</p>
  
  <p>Something along the lines of:</p>
  
  <pre><code>try:
      call(["docker", "run", "--name", "{}".format(containerName), "--detach", "--publish", "8080:8080", "user/software:{}".format(swVersion)])
  except:
      # How do I catch the piped response code here?`
  </code></pre>