C macros in Python.
Steve Holden
sholden at holdenweb.com
Fri Oct 13 14:59:42 EDT 2000
Steve Juranich wrote:
>
> I was just wondering if there was anything available in Python like the
> __FILE__ and __LINE__ macros in C. I know about the __name__ attribute, but
> I'm not sure that does exactly what I'm looking to do.
>
> What I'd like to do is write some code that will tell me _exactly_ on which
> file and while line things went wrong.
>
> Thanks for the help.
>
> ----------------------------------------------------------------------
> Stephen W. Juranich sjuranic at ee.washington.edu
> Electrical Engineering http://students.washington.edu/sjuranic
> University of Washington http://rcs.ee.washington.edu/ssli
--
The "approved" means of accessing this information would, I believe, be
the use of the traceback standard module. This will involve learning the
structure of the traceback objects it deals with, but you should be able
to get everything you need - it's intended to allow customized exception
responses such as you describe.
regards
Steve
Helping people meet their information needs with training and technology.
703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/
More information about the Python-list
mailing list