Launching pdb from within a script

Mike C. Fletcher mcfletch at rogers.com
Sun Jan 4 16:30:50 EST 2004


Peter Otten wrote:

>Graham Nicholls wrote:
>  
>
...

>>But pdb complains that there are no such variables.  It may be that I had
>>to add some incantation around the script startup - I just can't remember
>>(and its frustrating!).
>>    
>>
...

>-> Pdb().set_trace()
>(Pdb) abc
>*** NameError: name 'abc' is not defined
>(Pdb) u
>  
>
This is the key line, 'n' would work as well.  The reason your variables 
weren't being found is that you were still inside the call to 
set_trace().  You need to return from that (either by going "u"p to the 
calling context, or to the "n"ext instruction, which returns to the 
calling context by finishing the set_trace() call).

Enjoy,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/







More information about the Python-list mailing list