Adding variables in globals() of pdb
Don't know if this is a bug with python pdb, but if you try accessing variables inside a lambda function, it doesn't work in pdb session.
This makes it difficult to debug your code which has lambda
This makes it difficult to debug your code which has lambda
(Pdb++) ls = nat_operations.get_ls_connected_to_tier(topology, lambda x: x == lr)
*** NameError: global name 'lr' is not defined
The variable is otherwise accessible:
(Pdb++) lr
Add the variable to global:
(Pdb++) globals()['lr'] = lr
Then the function works correctly:
(Pdb++) ls = nat_operations.get_ls_connected_to_tier(topology, lambda x: x == lr)
(Pdb++) ls
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home