Skip to main content

Friendlier tracebacks in any language.

Project description

friendly-traceback logo

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.

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.

Installation

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.

First, we show the output of friendly-traceback

    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

Next, the same output shown as a screen capture when using friendly. Screen capture of the above example

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.

JetBrains

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

friendly-0.7.0.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

friendly-0.7.0-py3-none-any.whl (94.1 kB view details)

Uploaded Python 3

File details

Details for the file friendly-0.7.0.tar.gz.

File metadata

  • Download URL: friendly-0.7.0.tar.gz
  • Upload date:
  • Size: 82.1 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.6

File hashes

Hashes for friendly-0.7.0.tar.gz
Algorithm Hash digest
SHA256 872f20e6c3315ecba18d9b0e647bc7296d3a6267c02326acc6593bf8eb876fc7
MD5 9ea393d51a42a3ef68e3dec740cb762b
BLAKE2b-256 551720b56ddbf7c17e98e4672ff5f45e56168cd993041e136b9a3e5e7256f916

See more details on using hashes here.

File details

Details for the file friendly-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: friendly-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 94.1 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.6

File hashes

Hashes for friendly-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 743e1e56e921e79010df5d22ff4e28a943d0afab2d68c1a5edc771a28fe3221e
MD5 d8baf1afa6309f5dd36bb37a83ec2e7a
BLAKE2b-256 738f32e962d88aa3211e145ba0bf5b02a6dd0de7da7c4673fe23c2294ea91fb3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page