Jul-12-2019, 06:01 AM
I don't think there is any equivalent of the #line preprocessing directive in python. What you could do is catch the exception and transform the output of
traceback.format_tb()
by replacing items such as ['File "sum.py" line 10 ...']
with the correct line and file reference. This supposes that you store these position informations in a separate file when you create sum.py.