When error occured Python prints something like this:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 8, in m
File "<stdin>", line 5, in exec_st
File "<stdin>", line 9, in exec_assign
File "<stdin>", line 48, in ref_by_id
IndexError: list index out of range
where 2, ... , 48 are relative line numbers which are not very convenient. How to print absolute line numbers in such error messages?
EDIT:
Maybe it's a dumb question, but answer will facilitate development a little.
I'm printing text in several files. When done, press shortcut which runs python and copies contents of current file to console. Proposed solution forces to press excess keystrokes (Ctrl+S, Alt+Tab) and create additional files. I hope I have put it clear.