better-exceptions-hook icon indicating copy to clipboard operation
better-exceptions-hook copied to clipboard

Avoid need for separate module

Open anntzer opened this issue 8 years ago • 0 comments

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.)

anntzer avatar Apr 05 '17 22:04 anntzer