pythonで実行中のファイル、関数、行番号を取得する - Qiita

python3でエラーになるのでframe = inspect.currentframe(depth + 1)からframe = inspect.currentframe().f_backに修正…