Friendlier tracebacks in any language.
Project description
friendly/friendly-traceback
- friendly_traceback: Helps understand Python traceback
- friendly: Prettier version of the above with some additional enhancements.
This code repository is for friendly_traceback.
Unless specified otherwise, from here on, Friendly will refer to both friendly and friendly_traceback
Description
Created with Python beginners in mind, but also useful for experienced users, Friendly replaces standard tracebacks by something easier to understand, translatable into various languages. Currently, the information provided by Friendly is only available in two languages: English and French.
The additional information provided by Friendly includes
why()
a certain exception occurred,
what()
it means, exactly where()
it occurred including
the value of relevant variables, and
more.
The screenshot above was taken on Windows. In some other operating systems
you might need to type python3
instead of python
: Friendly
requires Python version 3.6 or newer.
Installation
python -m pip install friendly_traceback
Note that most users should install friendly instead of friendly_traceback,
python -m pip install friendly
This needs to be done from a terminal.
In the command shown above,
python
refers to whatever you need to type to invoke your
favourite Python interpreter.
It could be python
, python3
, py -3.8
, etc.
For some special cases, including using a specialized editor like Mu that has its own way of installing Python packages, please consult the documentation.
Documentation
The documentation is available by clicking here.
Example
The following example illustrates the information that can be provided by Friendly.
Traceback (most recent call last):
File "<friendly-console:5>", line 1, in <module>
test()
File "<friendly-console:4>", line 2, in test
a = cost(pi)
NameError: name 'cost' is not defined
Did you mean `cos`?
A `NameError` exception indicates that a variable or
function name is not known to Python.
Most often, this is because there is a spelling mistake.
However, sometimes it is because the name is used
before being defined or given a value.
In your program, `cost` is an unknown name.
Instead of writing `cost`, perhaps you meant one of the following:
* Global scope: `cos`, `cosh`, `acos`
Execution stopped on line 1 of file `'<friendly-console:5>'`.
-->1: test()
test: <function test>
Exception raised on line 2 of file `'<friendly-console:4>'`.
1: def test():
-->2: a = cost(pi)
^^^^
global pi: 3.141592653589793
Projects using Friendly
friendly/friendly-traceback is used by:
Feel free to contact me to add your project to this list.
Contribute
Contribute by making suggestions for improvements, pointing out mistakes either in the documentation or in the information provided by Friendly, or finding bugs.
If you speak a language other than English or French and feel ambitious, you might want to work on translations into your own language.
For more details, see CONTRIBUTING
License: MIT
For more details, see LICENSE.
Some ideas were adopted from DidYouMean-Python (aka BetterErrorMessages) by Sylvain Desodt, a project that is also using the MIT license; as of October 2021, that particular project is no longer maintained.
Code of Conduct
In short: be respectful of everyone.
For more details, see Code of Conduct
JetBrains support
We graciously acknowledge the support of JetBrains which enables us to use the professional version of PyCharm for developing Friendly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file friendly-traceback-0.7.61.tar.gz
.
File metadata
- Download URL: friendly-traceback-0.7.61.tar.gz
- Upload date:
- Size: 691.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca149ea4effa114a9d4354078d0252dbc53e291cdcc63f23e34b8fb65ba15f3 |
|
MD5 | a10897ded45df72ac4dc398f471e5731 |
|
BLAKE2b-256 | 5693f9a360efd1dba0324786d679fdbff630279f3388329b2ae5620514311e99 |
File details
Details for the file friendly_traceback-0.7.61-py3-none-any.whl
.
File metadata
- Download URL: friendly_traceback-0.7.61-py3-none-any.whl
- Upload date:
- Size: 732.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6945346e49a4ef72c855723f09a6d9b1b4fbf43759d4529f779f29259efab9f7 |
|
MD5 | b63a01467dcf4a5c0a5df5f2d94e3ec5 |
|
BLAKE2b-256 | df9ccd62dbb7ebb4a979d0a5b8d909bd764fa125224045f00b36b81db90f3542 |