paradoxxxzero / better-exceptions-hook Goto Github PK
View Code? Open in Web Editor NEWbetter-exceptions import hook
better-exceptions import hook
I ran
pip install better-exceptions-hook
For both Python2 and Python3, and then ran the following file (bla.py):
a = "hello"
b = "world"
assert a == b
Here's the output:
erez@localhost ~ $ python2 bla.py
Traceback (most recent call last):
File "bla.py", line 4, in <module>
assert a == b
│ └ 'world'
└ 'hello'
AssertionError: assert a == b
erez@localhost ~ [1]$ python3 bla.py
Traceback (most recent call last):
File "bla.py", line 4, in <module>
assert a == b
AssertionError
Any idea why?
I'm unfamiliar with import hooks and the standard library documentation does not mention where to place .pth files. How would I go about installing this?
Thanks, this sounds very promising!
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.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.