Skip to main content

Friendlier tracebacks in any language.

Project description

friendly-traceback and friends

Important This is a new project (created on June 27) from an existing project. This README has been copied from the precursor project and needs to be updated.

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.

friendly used to be called friendly-traceback.

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:

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

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_traceback-0.3.157.tar.gz (200.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

friendly_traceback-0.3.157-py3-none-any.whl (229.4 kB view details)

Uploaded Python 3

File details

Details for the file friendly_traceback-0.3.157.tar.gz.

File metadata

  • Download URL: friendly_traceback-0.3.157.tar.gz
  • Upload date:
  • Size: 200.7 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_traceback-0.3.157.tar.gz
Algorithm Hash digest
SHA256 e30ff1f37f19cee30ea71180f54ff5f9f6b4a2de171628186c5cafa89ebb07bb
MD5 a1c724e966277071462b041390df1289
BLAKE2b-256 e2d2a90243c16d927464c9eca94d56297a021bd31e5d705bcf5874aead443b89

See more details on using hashes here.

File details

Details for the file friendly_traceback-0.3.157-py3-none-any.whl.

File metadata

  • Download URL: friendly_traceback-0.3.157-py3-none-any.whl
  • Upload date:
  • Size: 229.4 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_traceback-0.3.157-py3-none-any.whl
Algorithm Hash digest
SHA256 b8a8a10be3a878d7bbdb2b8e845e291576419e011aee59485383f450885f881f
MD5 e29d3abc5ec0574972a62d108178ade1
BLAKE2b-256 701a4d5dabacfc054d8d7145cf3693d9499fb8fbc6b4d2206d485ab598608876

See more details on using hashes here.

Supported by

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