Last active
June 10, 2019 18:13
-
-
Save bhpayne/ec2f9dffd1c8b9c98f7ec80bf7b01621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inspect import stack, currentframe, getframeinfo # file name and line number | |
def prntln(*args): | |
""" | |
https://stackoverflow.com/questions/24438976/python-debugging-get-filename-and-line-number-from-which-a-function-is-called | |
""" | |
caller = getframeinfo(stack()[1][0]) | |
print(caller.filename, caller.lineno, args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment