Skip to content

Instantly share code, notes, and snippets.

@felipecustodio
Created April 18, 2018 15:01
Show Gist options
  • Select an option

  • Save felipecustodio/06d6ee8e2e89e9dca7597f99ab758990 to your computer and use it in GitHub Desktop.

Select an option

Save felipecustodio/06d6ee8e2e89e9dca7597f99ab758990 to your computer and use it in GitHub Desktop.
Colorized output for errors when executing python script on terminal
if __name__ == '__main__':
try:
import IPython.core.ultratb
except ImportError:
# No IPython. Use default exception printing.
pass
else:
import sys
sys.excepthook = IPython.core.ultratb.ColorTB()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment