Kottiyath> I dont want the whole traceback. I just wanted to know where
    Kottiyath> the log was generated from i.e. which procedure and which
    Kottiyath> line.

The asyncore standard module has an undocumented compact_traceback()
function:

    #!/usr/bin/env python

    import asyncore

    def f():
        1/0

    def g():
        f()

    def h():
        g()

    try:
        h()
    except ZeroDivisionError:
        print asyncore.compact_traceback()[3]

Output looks like this:

    % python f.py
    [f.py|<module>|15] [f.py|h|12] [f.py|g|9] [f.py|f|6]

Might be of interest.

-- 
Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to