Function call arguments in stack trace?

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 7 15:52:30 EDT 2011


On Tue, Jun 7, 2011 at 1:31 PM, Dun Peal <dunpealer at gmail.com> wrote:
> On Jun 7, 1:23 pm, Neil Cerutti <ne... at norwich.edu> wrote:
>> Use pdb.
>
> Neil, thanks for the tip; `pdb` is indeed a great debugging tool.
>
> Still, it doesn't obviate the need for arguments in the stack trace.

Your program could use sys.excepthook to generate a custom stack trace
for unhandled exceptions.  All the stack frames are available from the
traceback, but extracting the arguments would be tricky, and getting
the original arguments would be impossible if they've been reassigned
prior to the exception being raised.  It would be simpler just to dump
all the locals in the frame.



More information about the Python-list mailing list