Home

Zentrader <zentraders@gmail.com> wrote:
>This is the "standard" way AFAIK
>.try :
>. some_process
>.except :
>. import trackback, sys
>. et, ev, tb = sys.exc_info()
>. while tb :
>. co = tb.tb_frame.f_code
>. print "Filename = " + str(co.co_filename)
>. print "Error Line # = " + str(traceback.tb_lineno(tb))
>. tb = tb.tb_next
>. print "error type = ", et
>. print "error var name = ", ev

Personally, I find:

try:
some_process
except:
import traceback
traceback.print_exc()
raise

just as informative and much easier to write.

--
\S -- siona@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump

previous
next

Re: for statement on empty iterable
Re: Convert on uppercase unaccentent unicode character
Re: Getting error while making delete operator private
Re: Is this C style function well written and thread safe?
Re: Find Out How the Neocons Staged a Terror Attack That Killed Thousands of Americans on 9/11
Mam Marzenie
Mimo Wszystko
Fundacja Sloneczko
Krwinka
Fundacja Hobbit