This project is being split into 3 separate projects:

  • friendly_traceback,

  • friendly, and

  • friendly_idle.

The documentation does not reflect this change.

If you are a end-user, just install friendly until further notice.

Code on Github

Bienvenue 환영합니다 Bienvenido - ようこそ Welcome 歡迎光臨

friendly helps users understand what caused a given exception in their Python program, and how to fix it.

There exists many Python projects whose primary goal is to supplement the information given by Python traceback to make them more useful for advanced programmers. To my knowledge, of all those projects, friendly is the only one designed with beginners in mind.

To be more specific, while friendly can be useful for advanced programmers, it strives to present the information in a way that is easily understood by beginners and/or by users who would like to get information about traceback in their own language. friendly can give more detailed information as to where an exception occurred, what a given exception means and why it might have occurred (sometimes adding suggestions as to how to fix it.)

Even though friendly can be used on its own with a specially designed console, a better option might be to use it together with GUI-based editors/IDE including JupyterLab and Jupyter notebooks. I explain how to do so later. For now, I’ll just show one quick example.

A quick look

Consider the following program:

# example.py
def get_last(seq):
    last_index = len(seq)
    return seq[last_index]

print(get_last([1, 2, 3]))

First, here is what happens when I use Python to run this program.

Python IndexError example

Not exactly the most helpful information for beginners …

Here’s the corresponding version with full explanation from friendly, making use of Rich to produce a colourful output.

friendly IndexError example in English

One unique feature of friendly is that all the information it provides can be translated into another language; currently, only English (by default) and French are available but other languages could easily be added.

friendly IndexError in French

Keep reading if you want to find out more.