I was led on another wild goose chase bug hunting this in an ajax function that had heavily nested try/except blocks because it hid the real line number of the error.
For me, this was a simple error caused by passing an argument to myobject.get() without a keyword.
MyModel.objects.get(3)
This makes me want to explore more robust exception handling that pulls line numbers into the error message. I’m sure it would pay for itself in time.
try:
MyModel.objects.get(3)
except Exception, e:
log.debug("Exception {e} thrown on line {lineno}".format(
e=e,
lineno=sys.exc_info[2].tb_lineno,
)