Show HN: Debugging-Friendly Tracebacks for Python
github.com
github.com
# 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
Thanks for making it available, the output looks neat, looking forward to try it out.
With nose-progressive, you can specify --progressive-editor or update the .noserc so that traceback filepaths are prefixed with your preferred editor command.
vim-unstack parses paths from stack traces / tracebacks (for a number of languages including Python) and opens each in a split at that line number. https://github.com/mattboehm/vim-unstack
Here's the Python regex from my hackish pytb2paths.sh script:
'\s+File "(?P<file>.*)", line (?P<lineno>\d+), in (?P<modulestr>.*)$'
https://github.com/westurner/dotfiles/blob/develop/scripts/p...I bring this up because this looks like it discloses variable values into the log that would not be printed in a standard traceback under most normal circumstances.
well, not me anyway
A PEP has a lot more to consider than a standalone, third-party projects. They also need to support most (of not all) usages of Python, which is extremely involved. E.g. zip import might be a problem, from the top of my head.
It is always worth considering proposing a PEP, of course. But don’t expect people to have interests in proposing, or (if they do propose) the proposal to get anywhere without significant efforts (and compromises).