Menu

Changing values of "Globals" in debugger

Oskar Heck
2007-08-17
2013-03-15
  • Oskar Heck

    Oskar Heck - 2007-08-17

    Eclipse europe 3.3.0, pyDev 1.3.8

    If i try to change the value of a variable in the debugger "Variables" view, inside "Globals", then i get:

    Traceback (most recent call last):
      File "C:\Programme\eclipse\plugins\org.python.pydev.debug_1.3.8\pysrc\pydevd_vars.py", line 291, in changeAttrExpression
        exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals
      File "<string>", line 1, in <module>
    NameError: name 'Globals' is not defined

    I have a workaround /solution for this. Put this in pydevd_vars.py, function "changeAttrExpression":

            if attr[:7] == "Globals":
                attr = attr[8:]
                if attr in frame.f_globals:
                    frame.f_globals[attr] = eval(expression, frame.f_globals, frame.f_locals)
            exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals

    Cheers,

    Oskar

     
    • Oskar Heck

      Oskar Heck - 2007-08-17

      Help! Indention got lost!

      if attr[:7] == "Globals":
      ....attr = attr[8:]
      ....if attr in frame.f_globals:
      ........frame.f_globals[attr] = eval(expression, frame.f_globals, frame.f_locals)
      exec '%s=%s' % (attr, expression) in frame.f_globals, frame.f_locals

       
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-08-17

      Please add that to the bugtracker...

      Thanks,

      Fabio