On 7-6-2011 21:31, Dun Peal wrote: > On Jun 7, 1:23 pm, Neil Cerutti <ne...@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.
If you can't use pdb perhaps you can use the following: Pyro has always had a feature that prints detailed stacktraces. It is mainly meant to clarify stacktraces that occur on a different machine (where you don't have the option of using pdb), but can very well be used for normal code too: import sys import Pyro4.util Pyro4.config.DETAILED_TRACEBACK=True sys.excepthook=Pyro4.util.excepthook def divide(a,b): return a//b def dividebysomething(a): return divide(a,0) print dividebysomething(10) When you run this, this will be printed: [E:\projects]python trace.py -------------------------------------------------- <<type 'exceptions.ZeroDivisionError'>> RAISED : integer division or modulo by zero Extended stacktrace follows (most recent call last) -------------------------------------------------- File "trace.py", line (13), in <module> Source code: print dividebysomething(10) File "trace.py", line (11), in dividebysomething Source code: return divide(a,0) Local values: a = 10 -------------------------------------------------- File "trace.py", line (8), in divide Source code: return a//b Local values: a = 10 b = 0 -------------------------------------------------- <<type 'exceptions.ZeroDivisionError'>> RAISED : integer division or modulo by zero -------------------------------------------------- You can find the relevant code that produces these kinds of tracebacks in the util.py source file of Pyro. You can get that from Pypi: http://pypi.python.org/pypi/Pyro4/ or the file directly from subversion: $ svn export svn://svn.razorvine.net/Pyro/Pyro4/trunk/src/Pyro4/util.py Perhaps you can use this or adapt it to suit your needs. Irmen de Jong -- http://mail.python.org/mailman/listinfo/python-list