title: python - show variables during traceback
body: <p>I have created the following situation:</p>
  
  <p>I have a cronjob that runs some python code and it crashes. Consider this code:</p>
  
  <pre><code>import json
  
  uno = 1
  print json.loads(uno)
  </code></pre>
  
  <p>I receive the following traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "thiswillbreak.py", line 4, in &lt;module&gt;
      print json.loads(uno)
    File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  TypeError: expected string or buffer
  </code></pre>
  
  <p>Is there anyway for me to also receive a list of all the variables in the scope so that I can debug this on the fly instead of attempting to reproduce the scenario? Obviously hard-coded values are easy, but if this value is obtained from some other place - debugging gets harder.</p>
  
  <p>In particular I'm also using Django, which I know has loggers, but I couldn't find any information on how to enable variable printing. I only found how to hide sensitive variables, which isn't a problem because I don't see <em>any</em> variables at all.</p>