Debugging exceptions


If my Python code has an error, I get a message like this on the console:

[Thread 1 exited with exception ValueError @[0015:038A:0000:0000:0000:0000:0000:0000]](javascript:window.except('@[0015:038A:0000:0000:0000:0000:0000:0000]','Thread 1 exited with exception ValueError '))
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 32524, room 16 
tail 12
chksum 0x97
ho 0 tail 12 room 4
load 0x3ffe8000, len 2276, room 12 
tail 8
chksum 0xae
load 0x3ffe88f0, len 7672, room 0 
tail 8
chksum 0x2a
csum 0x2a

Is there some way to associate that with a line number or something in the code? Adding a bunch of prints to narrow down the offending line is tedious.