Created
March 31, 2020 23:32
-
-
Save erikerlandson/f042fffde7e2aeb5f010e0254b873971 to your computer and use it in GitHub Desktop.
wrap a .ipy file in a big try/catch to catch any exception
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
$ echo "try:" > eje.ipy | |
$ awk '{print " ", $0}' < simple.ipy >> eje.ipy | |
$ cat >> eje.ipy <<- EOF | |
> except Exception as e: | |
> print("===========") | |
> print(e) | |
> print("===========") | |
> EOF | |
$ ~/conda/bin/ipython eje.ipy | |
45 | |
time magic | |
CPU times: user 8 µs, sys: 1 µs, total: 9 µs | |
Wall time: 11 µs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment