title: Getting the name which is not defined from NameError in python
body: <p>As you know, if we simply do:</p>
  
  <pre><code>&gt;&gt;&gt; a &gt; 0
  Traceback (most recent call last):
    File "&lt;pyshell#1&gt;", line 1, in &lt;module&gt;
      a &gt; 0
  NameError: name 'a' is not defined
  </code></pre>
  
  <p>Is there a way of catching the exception/error and extracting from it the value 'a'.
  I need this because I'm <code>eval</code>uating some dynamically created expressions, and would like to retrieve the names which are not defined in them.</p>
  
  <p>Hope I made myself clear.
  Thanks!
  Manuel</p>