title: How to identify what function call raise an exception in Python?
body: <p>i need to identify who raise an exception to handle better str error, is there a way ?</p>
  
  <p>look at my example:</p>
  
  <pre><code>try:
     os.mkdir('/valid_created_dir')
     os.listdir('/invalid_path')
  except OSError, msg:
  
     # here i want i way to identify who raise the exception
     if is_mkdir_who_raise_an_exception:
        do some things
  
     if is_listdir_who_raise_an_exception:
        do other things ..
  </code></pre>
  
  <p>how i can handle this, in python ? </p>