Python Error
Duncan Booth
duncan.booth at invalid.invalid
Mon Jul 30 07:15:06 EDT 2012
Jürgen A. Erhard <jae at jaerhard.com> wrote:
> Peter's right, but instead of a print before the line, put a
> try/except around it, like
>
> try:
> set1 = set(list1)
> except TypeError:
> print list1
> raise
>
> This way, only the *actual* error triggers any output. With a general
> print before, you can get a lot of unnecessary output.
>
> Grits, J
>
Or even better:
try:
set1 = set(list1)
except TypeError:
print list1
import pdb; pdb.set_trace()
raise
Then the error will print the value of list1 and drop you into the debugger
so you can examine what's going on in more detail.
--
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list
mailing list