Skip to content

Instantly share code, notes, and snippets.

@krassowski
Created March 17, 2019 17:04
Show Gist options
  • Save krassowski/c6373c155e264bedd7581129a30c7657 to your computer and use it in GitHub Desktop.
Save krassowski/c6373c155e264bedd7581129a30c7657 to your computer and use it in GitHub Desktop.
Play sound on exception - IPython
# 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