I have a pdb trace set inside a GET request. I want to print all the attributes of the request object. I am trying the following, in pdb:
(Pdb) request
<GET /foo HTTP/1.1>
(Pdb) for d in dir(request):
*** SyntaxError: unexpected EOF while parsing (<stdin>, line 1)
I am sure there is something fundamental I am missing here.
You can’t enter multi-line statements in
pdb. You can use thecommandscommand if the code block is to be executed on a break point, though;help commandsfor more information.You can also sometimes collapse a multi-line statement into a single line. For example:
In your particular case, though, it seems that either
print dir(request)orpp dir(request)would suffice.