title: Viewing Local Variables in Spyder's Variable Explorer
body: <p>I'm new to python and am using Spyder's IDE. One feature I appreciate about it is it's variable explorer. However, based on some research, I found that it only shows global variables. A workaround that I found for that is by using the inspect module:</p>
  
  <pre><code>import inspect
  
  local_vars = {}
  
  def main():
      global local_vars
      a = 2
      b = 4
      c = a+b
      local_vars = inspect.currentframe().f_locals
      return c
  
  main()
  </code></pre>
  
  <p>This works well, however, I have other functions that are called from within main() and I'd like to see those variables in the variable explorer as well. I mimicked what was done for the variables in the main function and the dict does not appear. I noticed that when I disable the setting to "exclude unsupported data types" in Spyder's variable explorer options, the second dict appears with the right size attribute, however, I am unable to open/view it. Any ideas on a possible work around? This is my first time posting BTW. </p>
  
  <p>Thanks!!</p>
  
  <hr>
  
  <p>Here is a working example of my issue and I've traced it down to pylab subplots. </p>
  
  <pre><code>import inspect, pylab
  
  mainVars = {}
  
  def main():
      global mainVars
  
      a = 1
      b = 2
  
      fig = pylab.figure()
      subPlot = fig.add_subplot(211)    ## line of interest
  
      pylab.close('all')
  
      mainVars = inspect.currentframe().f_locals
  
  main()
  </code></pre>
  
  <p>When the line of interest is commented out, the dict is created successfully and can be viewed. It appears that the object created using fig.add_subplot() is not being handled properly by the dict. It seems to be an unsupported datatype. </p>
  
  <p>Hope this helps clarify the issue.</p>
  
  <p>Thanks again.</p>