I have a code similar to this:
try:
if x:
statement1
statement2
statement3
elif y:
statement4
statement5
statement6
what about this:
try:
if x:
print 'before statement 1'
statement1
print 'before statement 2' #ecc. ecc.
statement2
statement3
elif y:
statement4
statement5
statement6
else:
raise
except:
statement7
this is the straightforward workaround but I suggest to use a debugger
or even better, use the sys module :D
try:
if x:
print 'before statement 1'
statement1
print 'before statement 2' #ecc. ecc.
statement2
statement3
elif y:
statement4
statement5
statement6
else:
raise
except:
print sys.exc_traceback.tb_lineno
#this is the line number, but there are also other infos