Re:Show HN: Debugging-Friendly Tracebacks for Python
by achamayou on Sunday April 28, 2019 @04:27PM
(#19773484)
It would be nice to integrate the context functionality into https://github.com/Qix-/better-exceptions
[ Parent
| on HN ]
Re:Show HN: Debugging-Friendly Tracebacks for Python
by cknd on Sunday April 28, 2019 @05:13PM
(#19773723)
I always liked how this automatically hooks into the python installation via pip, but preferred another text format. Hm. So if you want to permanently replace python's crash message, you could put a file `sitecustomize.py` into your python path, with these contents for example:
# in site-packages/sitecustomize.py:
print('hello!')
import sys; sys.excepthook = lambda a,b,c: print('<bomb emoji>')
# or also:
import stackprinter
stackprinter.set_excepthook(style='darkbg')
(you can find the path by `python -c "import site; print(site.PREFIXES)" `)It felt bit much to do that automatically on installation, but maybe it would be a good option to have
Re:Show HN: Debugging-Friendly Tracebacks for Python
by tastroder on Sunday April 28, 2019 @07:05PM
(#19774363)
In case you're looking for opinions there: I pretty much like libraries like this for development but prefer manual activation, e.g. only when my system is running with a debug flag, over libraries messing with the environment itself.
Thanks for making it available, the output looks neat, looking forward to try it out.