How can I get the line number of error

I try to make that coding on OpenMV with touch screen with out computer.I have finished many jobs.But I met a problem. I have tryed to use ‘try/except’ ot get the error.But it cant tell the line number of error. I see the 'traceback' information in IDE.But I cant import it in codes.Is there any way to get line number of error?

I almost tried every way that I can found. But not a single one can work. The ‘tracework‘ seems to be the most reliable way. But it can’t import on OpenMV. Is it removed on OpenMV?Do you know any code to replace it?

Exception objects in python 3 include the line number. It’s literal printed in the ide terminal. This information is there.

Screenshot
You see,I am making a local programming environment like this with out computer.But I can`t get error line in it.I saw error line information in IDE.So is there any way I can get it in local program?

You’ll have to parse the output. The exception object doesn’t make that info available to the Python side.