Skip to content

Instantly share code, notes, and snippets.

@whosaysni
Created October 4, 2016 12:52
Show Gist options
  • Save whosaysni/8330b6d1e17e6a68675d557ba5acc5b5 to your computer and use it in GitHub Desktop.
Save whosaysni/8330b6d1e17e6a68675d557ba5acc5b5 to your computer and use it in GitHub Desktop.
例外をプギャーする
>>> sys.excepthook = lambda y,v,r: sys.stderr.write(u'プギャー m9 (^д^)9m <{}\n'.format(y.__name__))
>>> 1/0
プギャー m9 (^д^)9m <ZeroDivisionError
>>> 'asdf' + 1
プギャー m9 (^д^)9m <TypeError
>>> __import__('math').sqrt(-1)
プギャー m9 (^д^)9m <ValueError
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment