need help with pdb

Christian Schaller Christian.Schaller at
Wed Feb 2 10:33:25 EST 2000


  after encountering problems with installing RedHat Linux, I had my
first encounter with pdb.  There are some topics I don't know how to be

  At first, I know I can change a variable simply by using
(pdb) ! var = 'foo'
But can I continue execution of a program with that changed value?  Say,
var contained a key for a dictionary and the key was not found.  If I
change the key to a value that I know is contained in the dictionary,
can I retry that line of code so the execution continues?

  The pdb documentation says, that assignments are always done in the
current frameset.  So if I have a local variable that is used in a
function and the execution is stopped in that function, how can I change
that value?
def f():
  var = 'foo'
  print var #(stop execution at that line)

(pdb) p var
prints the value, but if I change that value to
(pdb) var = 'bar'
is returned again?!?

  Can anyone help me?

Thanks a lot in advance!


More information about the Python-list mailing list