Only Python: Friendly version 0.3 has been released
source link: https://aroberge.blogspot.com/2021/03/friendly-version-03-has-been-released.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Friendly version 0.3 has been released
Friendly version 0.3 has been released. This version also marks the official name change from the former friendly-traceback.
Before I started working on Friendly, I assumed that to do custom exception handling, one simply had to redefine sys.excepthook. However, I since found out that this does not work in many environments, including all those based on IPython (which include Jupyter notebooks). Even Python's IDLE, at least up until Python version 3.10.0a5, does not work with a simple replacement of sys.excepthook.
Additionally, creating coloured output varies depending on the programming environment. Thankfully, this can be done in most environments simply by using Rich -- sometimes supplemented by a bit of additional code.
As a result, friendly includes various custom modules so that it can work with the following:
- IDLE (see this and the following 2 pages)
- Mu (see four pages starting here)
- Jupyter notebooks and Jupyter Lab (which also work with Google colab)
- IPython console
- VS Code (either running from the terminal or with embedded notebooks)
>>> a = math.sine(1)
Traceback (most recent call last):
File "<friendly-console:2>", line 1, in <module>
a = math.sine(1)
AttributeError: module 'math' has no attribute 'sine'
Did you mean one of the following: `sin, sinh, asin`?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK