title: Python exception handling - line number
body: <p>I'm using python to evaluate some measured data. Because of many possible results it is difficult to handle or possible combinations. Sometimes an error happens during the evaluation. It is usually an index error because I get out of range from measured data.</p>
  
  <p>It is very difficult to find out on which place in code the problem happened. It would help a lot if I knew on which line the error was raised. If I use following code:</p>
  
  <pre><code>try:
      result = evaluateData(data)
  except Exception, err:
      print ("Error: %s.\n" % str(err))
  </code></pre>
  
  <p>Unfortunately this only tells me that there is and index error. I would like to know more details about the exception (line in code, variable etc.) to find out what happened. Is it possible?</p>
  
  <p>Thank you.</p>