title: checking the return code using python (MAC)
body: <p>I have written a script that checks if an SVN Repo is up and running, the result is based on the return value.</p>
  
  <pre><code>import subprocess
  
  url = " validurl"
  
  
  def check_svn_status():
      subprocess.call(['svn info'+url],shell=True)
  
  def get_status():
      subprocess.call('echo $?',shell=True)
  
  
  
  def main():
      check_svn_status()
      get_status()
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>The problem I'm facing is that if I change the url to something that does't exist I still get the return value as 0, but if I were to run this outside the script, i.e go to the terminal type <code>svn info wrong url</code> and then do a <code>echo $?</code> I get a return value of 1. But I can't re-create this in the python. Any guidelines ?</p>
  
  <p><strong>TraceBack after updating</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "svn_status.py", line 21, in &lt;module&gt;
      main()
    File "svn_status.py", line 15, in main
      check_svn_status()
    File "svn_status.py", line 8, in check_svn_status
      p = sp.Popen(['svn info'], stdout=sp.PIPE, stderr=sp.PIPE)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
      errread, errwrite)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
      raise child_exception
  OSError: [Errno 2] No such file or director
  </code></pre>
  
  <p>y</p>