Last active
April 24, 2017 03:24
-
-
Save LittleWat/3d32e253753d61ae45b2f58c6d1ad65e to your computer and use it in GitHub Desktop.
Pythonスクリプトを走らせたときに,エラーになったらデバッガに入ってほしいときに使うと便利な関数メモ ref: http://qiita.com/LittleWat/items/79741b26a080c2dfb2f7
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
import sys | |
def set_debugger_org(): | |
if not sys.excepthook == sys.__excepthook__: | |
from IPython.core import ultratb | |
sys.excepthook = ultratb.FormattedTB(call_pdb=True) | |
def set_debugger_org_frc(): | |
from IPython.core import ultratb | |
sys.excepthook = ultratb.FormattedTB(call_pdb=True) | |
def set_trace(): | |
from IPython.core.debugger import Pdb | |
Pdb(color_scheme='Linux').set_trace(sys._getframe().f_back) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment