If inspect works as expected in IronPython (not quite sure), this might do the trick:
import inspect filename, linenum, funcname = inspect.getframeinfo(inspect.currentframe())[:3] print linenum
Edit : alternative solution:
import sys frame = sys._getframe() print frame.f_lineno
source share