Hi want to capture the traceback information

Hi,
    While running the python program....if any exception occured, traceback information is printing on the Interactive window, i want to capture that traceback information in a variable....

How can i do that ....give some example....

Regards
Bala