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.

Example 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

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

The following sites or projects use friendly_traceback:

Feel free to file an issue to add your site or project if it uses either friendly or friendly_traceback.

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.

License: MIT

Some of the ideas were adopted from DidYouMean-Python (aka BetterErrorMessages) by Sylvain Desodt, a project that is also using the MIT license.

Code of Conduct

We agree with the goals behind the creation of the Python Community Code of Conduct. Contributors to this project, including those filing or commenting on an issue, are expected to do the same.

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

friendly-0.4.19.tar.gz (68.5 kB view details)

Uploaded Source

Built Distribution

friendly-0.4.19-py3-none-any.whl (75.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: friendly-0.4.19.tar.gz
  • Upload date:
  • Size: 68.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.4

File hashes

Hashes for friendly-0.4.19.tar.gz
Algorithm Hash digest
SHA256 74d97105fcd6a973a68ca71c240b9db2446c26d0f95332037f470e2baac4a4f2
MD5 8273cdf34fdf7a8acc3d8a42d216b486
BLAKE2b-256 a2677256c6900af4e12161d8782ece7741a34d0f806520853e7198376e082ee1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: friendly-0.4.19-py3-none-any.whl
  • Upload date:
  • Size: 75.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.4

File hashes

Hashes for friendly-0.4.19-py3-none-any.whl
Algorithm Hash digest
SHA256 06c69f6c4c8589ad9e29b3f4d9d30f17235066a70c5146191a5271b83d745e2d
MD5 05f5c7f9b7a02e704873a7ebd6db4d62
BLAKE2b-256 df93b3bc994884d9bc3f8de3e31602ad21c42f514cc4d595fd1ecf3d744c52bc

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