Created
March 17, 2019 17:04
-
-
Save krassowski/c6373c155e264bedd7581129a30c7657 to your computer and use it in GitHub Desktop.
Play sound on exception - IPython
This file contains hidden or 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
# CC-BY-SA 4.0 Kevin (https://stackoverflow.com/a/41603739/6646912) | |
# https://creativecommons.org/licenses/by-sa/4.0/ | |
from IPython.display import Audio, display | |
def play_sound(self, etype, value, tb, tb_offset=None): | |
self.showtraceback((etype, value, tb), tb_offset=tb_offset) | |
display(Audio(url='http://www.wav-sounds.com/movie/austinpowers.wav', autoplay=True)) | |
get_ipython().set_custom_exc((ZeroDivisionError,), play_sound) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment