Wednesday, November 27, 2013

Changing a local variable in the Python debugger

I know that there is some issue with pdb debugger when you try to change a local variable.
But while trying to get any possible workaround, encountered this.
Have a look at it.

In the above case, local variable x has been changed in pdb mode. All I did was not to stop at any point after changing this variable.

Now look at this.

Here local variable has not been changed. Here after changing its value to "hello" all I did was to go stepwise. Even tried again to change it to "exper" but that also didn't work.

This has been a long-standing issue, dating back at least to this 2004 post on this topic.  There must be some temporary patch available for this.

Look for my new post. As soon as I find the fix, will post that here.