title: How do I inspect the scope of a function where Python raises an exception?
body: <p>I've recently discovered the very useful '-i' flag to Python</p>
  
  <pre>
  -i     : inspect interactively after running script, (also PYTHONINSPECT=x)
           and force prompts, even if stdin does not appear to be a terminal
  </pre>
  
  <p>this is great for inspecting objects in the global scope, but what happens if the exception was raised in a function call, and I'd like to inspect the local variables of the function? Naturally, I'm interested in the scope of where the exception was first raised, is there any way to get to it?</p>