blob: cc86a84d2ace704de7b1dc17d221e84358d5d4aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import linecache, sys
def trace(frame, event, arg):
# The weird globals here is to avoid a NameError on shutdown...
if frame.f_code.co_filename == globals().get("__file__"):
lineno = frame.f_lineno
print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, lineno).rstrip()))
return trace
print(sys.version)
sys.settrace(trace)
|