The exception object in micropython does not return the line number for me even on the most recent version of OpenMV. I was able to access the line number with the following snippet.
def get_exception(err) -> str:
buf = io.StringIO()
sys.print_exception(err, buf)
return buf.getvalue()