Re: printing line numbers for debugging purpose

2005-01-09 Thread python
Below is a function to get the current line number and file name. /Jean Brouwers - # dashes added to preserve indentation. - - import traceback - - def caller(up=0): - '''Get file name, line number, function name and -source text of the caller's caller as 4-tuple: -(file, li

Re: printing line numbers for debugging purpose

2005-01-08 Thread Michael Fuhr
"Philippe C. Martin" <[EMAIL PROTECTED]> writes: > All of the methods from my program return None on error (i.e; I do not > want to assert and have the program exit). > > Is it possible to print the current source file name/line number ? Someone else posted an example using an exception handler.

Re: printing line numbers for debugging purpose

2005-01-08 Thread Mark McEahern
Philippe C. Martin wrote: Hi, All of the methods from my program return None on error (i.e; I do not want to assert and have the program exit). Is it possible to print the current source file name/line number ? ex: in C/C++ I would use the macros __FILE__ and __LINE__. Consider something like this: