better-exceptions-hook
better-exceptions-hook copied to clipboard
Avoid need for separate module
You don't actually need to provide a separate better_exceptions_hook module, your pth file can just contain
import sys; exec('try:\n import better_exceptions\nexcept Exception: pass')
(The sys import is just a placeholder needed for the pth file to work.)
I got the trick from https://github.com/ionelmc/python-hunter/blob/master/setup.py#L47; see https://github.com/anntzer/mplcursors/blob/master/setup.py for a self-contained solution. (Here the embedded string is so short that you can probably just hard-code it.)