python - accessing variables in the debugging session with ipython and %pdb on -
i'm new ipython , trying use ipython debug code. did:
[1]: %pdb automatic pdb calling has been turned on
and then
in [2]: %run mycode.py
and in code, have 1/0 raises exception , automatically goes debug session.
zerodivisionerror: float division ipdb> variable array([ 0.00704313, -1.34700666, -2.81474391])
so can access variables. when following:
ipdb> b = variable *** specified object '= variable' not function or not found along sys.path.
but works:
ipdb> b = self.x
b
used set break points. whatever follows b
expected function or line number.
if type ipdb> help
see full list of commands (reserved words).
you use, say, x
or y
variable:
ipdb> y = variable
or
ipdb> exec 'b = variable'
Comments
Post a Comment