6

In ipdb using command a or args prints information on provided arguments for the method. How do I get actual args variable so I can work on the provided data?

For example when I have code:

class A(object):
    def test(*args, **kwargs):
        import ipdb; ipdb.set_trace()


A().test('testing arg')

Then after running the code I tried:

ipdb> args
args = (<__main__.A object at 0x1007bdf90>, 'testing arg')
kwargs = {}
ipdb> args[0]
args = (<__main__.A object at 0x1007bdf90>, 'testing arg')
kwargs = {}
ipdb>
  • 1
    http://frid.github.io/blog/2014/06/05/python-ipdb-cheatsheet/ from there is looks like "p args" might work. – Tom Dalton Jan 08 '18 at 13:20

2 Answers2

11

Prefix your command with ! to disable the pdb magic.

ipdb> !args
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
0

I often set dummy variables which are part of pdb magic and then use those

ipdb> aa = args
The Doctor
  • 334
  • 3
  • 11