title: How to return a value and raise an Exception
body: <p>I have two objectives with this <code>try</code>/<code>except</code> statement.</p>
  
  <ol>
  <li>It needs to <code>return</code> a value of 1 if no problems occurred, or 0 if any problems occurred.</li>
  <li>It needs to raise an exception and end the script.</li>
  </ol>
  
  <p>I have the <code>return</code> value working. I also have the <code>SystemExit()</code> working. But together, they aren't working.</p>
  
  <p><strong>My Python Script (that's relevant):</strong></p>
  
  <pre><code>except IOError:
      value_to_return = 0
      return value_to_return
      raise SystemExit("FOOBAR")
  </code></pre>
  
  <p>With this, it ignores the <code>raise SystemExit("FOOBAR")</code> line completely. How do I go about getting a returned value and still <code>raise SystemExit("FOOBAR")</code>? This may be elementary to some, but I'm actually having quite a bit of difficulty with it.</p>