Friendly tracebacks - in English

Friendly-traceback aims to provide friendlier feedback when an exception is raised than what is done by Python. Below, we can find some examples. SyntaxError cases, as well as TabError and IndentationError cases, are shown in a separate page. Ideally, an example of each case handled by friendly-traceback should be included here.

Note

The content of this page is generated by running trb_english.py located in the tests/ directory. This needs to be done explicitly, independently of updating the documentation using Sphinx. On Windows, if Sphinx is installed on your computer, it is suggested instead to run make_trb.bat in the root directory as it will create similar files for all languages and update the documentation.

Friendly-traceback version: 0.0.28a Python version: 3.7.3

ArithmeticError

Python exception:
    ArithmeticError:

ArithmeticError is the base class for those built-in exceptions
that are raised for various arithmetic errors.
It is unusual that you are seeing this exception;
normally, a more specific exception should have been raised.

Execution stopped on line 9 of file 'TESTS:\except\test_arithmetic_error.py'.

    7:         # Usually, a subclass such as ZeroDivisionError, etc., would
    8:         # likely be raised.
--> 9:         raise ArithmeticError

FileNotFoundError

Python exception:
    FileNotFoundError: [Errno 2] No such file or directory: 'does_not_exist'

A FileNotFoundError exception indicates that you
are trying to open a file that cannot be found by Python.
This could be because you misspelled the name of the file.

Likely cause based on the information given by Python:
    In your program, the name of the
    file that cannot be found is 'does_not_exist'.

Execution stopped on line 6 of file 'TESTS:\except\test_file_not_found_error.py'.

   4: def test_file_not_found_error():
   5:     try:
-->6:         open("does_not_exist")

ImportError

Python exception:
    ImportError: cannot import name 'Pi' from 'math' (unknown location)

This exception indicates that a certain object could not
be imported from a module or package. Most often, this is
because the name of the object is not spelled correctly.

Likely cause based on the information given by Python:
    The object that could not be imported is 'Pi'.
    The module or package where it was
    expected to be found is 'math'.

Execution stopped on line 6 of file 'TESTS:\except\test_import_error.py'.

   4: def test_import_error():
   5:     try:
-->6:         from math import Pi

KeyError

Python exception:
    KeyError: 'c'

A KeyError is raised when a value is not found as a
key in a Python dict.

Likely cause based on the information given by Python:
    In your program, the name of the key
    that cannot be found is 'c'.

Execution stopped on line 7 of file 'TESTS:\except\test_key_error.py'.

   5:     d = {"a": 1, "b": 2}
   6:     try:
-->7:         d["c"]

d: {'a': 1, 'b': 2}

LookupError

Python exception:
    LookupError:

LookupError is the base class for the exceptions that are raised
when a key or index used on a mapping or sequence is invalid.
It can also be raised directly by codecs.lookup().

Execution stopped on line 10 of file 'TESTS:\except\test_lookup_error.py'.

    8:         # other than possibly codecs.lookup(), which is why we raise
    9:         # it directly here for our example.
-->10:         raise LookupError

IndexError - short tuple

Python exception:
    IndexError: tuple index out of range

An IndexError occurs when you are try to get an item from a list,
a tuple, or a similar object (sequence), by using an index which
does not exists; typically, this is because the index you give
is greater than the length of the sequence.
Reminder: the first item of a sequence is at index 0.

Likely cause based on the information given by Python:
    In this case, the sequence is a tuple.

Execution stopped on line 8 of file 'TESTS:\except\test_index_error.py'.

    6:     b = [1, 2, 3]
    7:     try:
--> 8:         print(a[3], b[2])

a: (1, 2, 3)
b: [1, 2, 3]

IndexError - long list

Python exception:
    IndexError: list index out of range

An IndexError occurs when you are try to get an item from a list,
a tuple, or a similar object (sequence), by using an index which
does not exists; typically, this is because the index you give
is greater than the length of the sequence.
Reminder: the first item of a sequence is at index 0.

Likely cause based on the information given by Python:
    In this case, the sequence is a list.

Execution stopped on line 22 of file 'TESTS:\except\test_index_error.py'.

   20:     b = tuple(range(50))
   21:     try:
-->22:         print(a[50], b[0])

a: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13...]  | len(a): 40
b: (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13...)  | len(b): 50

ModuleNotFoundError

Python exception:
    ModuleNotFoundError: No module named 'does_not_exist'

A ModuleNotFoundError exception indicates that you
are trying to import a module that cannot be found by Python.
This could be because you misspelled the name of the module
or because it is not installed on your computer.

Likely cause based on the information given by Python:
    In your program, the name of the
    module that cannot be found is 'does_not_exist'.

Execution stopped on line 6 of file 'TESTS:\except\test_module_not_found_error.py'.

   4: def test_module_not_found_error():
   5:     try:
-->6:         import does_not_exist

NameError

Python exception:
    NameError: name 'c' is not defined

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.

Likely cause based on the information given by Python:
    In your program, the unknown name is 'c'.

Execution stopped on line 6 of file 'TESTS:\except\test_name_error.py'.

   4: def test_name_error():
   5:     try:
-->6:         b = c

OverflowError

Python exception:
    OverflowError: (34, 'Result too large')

An OverflowError is raised when the result of an arithmetic operation
is too large to be handled by the computer's processor.

Execution stopped on line 6 of file 'TESTS:\except\test_overflow_error.py'.

   4: def test_overflow_error():
   5:     try:
-->6:         2.0 ** 1600

TypeError - 1: concatenate two different types

Python exception:
    TypeError: can only concatenate str (not "int") to str

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to concatenate (add) two different types of objects:
    a string ('str') and an integer ('int')

Execution stopped on line 8 of file 'TESTS:\except\test_type_error.py'.

    6:         a = "a"
    7:         one = 1
--> 8:         result = a + one

a: 'a'
one: 1

TypeError - 1a: concatenate two different types

Python exception:
    TypeError: can only concatenate str (not "list") to str

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to concatenate (add) two different types of objects:
    a string ('str') and a list

Execution stopped on line 24 of file 'TESTS:\except\test_type_error.py'.

   22:         a = "a"
   23:         a_list = [1, 2, 3]
-->24:         result = a + a_list

a: 'a'
a_list: [1, 2, 3]

TypeError - 1b: concatenate two different types

Python exception:
    TypeError: can only concatenate tuple (not "list") to tuple

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to concatenate (add) two different types of objects:
    a tuple and a list

Execution stopped on line 40 of file 'TESTS:\except\test_type_error.py'.

   38:         a_tuple = (1, 2, 3)
   39:         a_list = [1, 2, 3]
-->40:         result = a_tuple + a_list

a_tuple: (1, 2, 3)
a_list: [1, 2, 3]

TypeError - 2: unsupported operand type(s) for +

Python exception:
    TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to add two incompatible types of objects:
    an integer ('int') and a variable equal to None ('NoneType')

Execution stopped on line 54 of file 'TESTS:\except\test_type_error.py'.

   52:         one = 1
   53:         none = None
-->54:         result = one + none

one: 1
none: None

TypeError - 2a: unsupported operand type(s) for +=

Python exception:
    TypeError: unsupported operand type(s) for +=: 'int' and 'str'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to add two incompatible types of objects:
    an integer ('int') and a string ('str')

Execution stopped on line 68 of file 'TESTS:\except\test_type_error.py'.

   66:         one = 1
   67:         two = "two"
-->68:         one += two

one: 1
two: 'two'

TypeError - 3: unsupported operand type(s) for -

Python exception:
    TypeError: unsupported operand type(s) for -: 'tuple' and 'list'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to subtract two incompatible types of objects:
    a tuple and a list

Execution stopped on line 82 of file 'TESTS:\except\test_type_error.py'.

   80:         a = (1, 2)
   81:         b = [3, 4]
-->82:         result = a - b

a: (1, 2)
b: [3, 4]

TypeError - 3a: unsupported operand type(s) for -=

Python exception:
    TypeError: unsupported operand type(s) for -=: 'list' and 'tuple'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to subtract two incompatible types of objects:
    a list and a tuple

Execution stopped on line 96 of file 'TESTS:\except\test_type_error.py'.

   94:         a = (1, 2)
   95:         b = [3, 4]
-->96:         b -= a

b: [3, 4]
a: (1, 2)

TypeError - 4: unsupported operand type(s) for *

Python exception:
    TypeError: unsupported operand type(s) for *: 'complex' and 'set'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to multiply two incompatible types of objects:
    a complex number and a set

Execution stopped on line 110 of file 'TESTS:\except\test_type_error.py'.

   108:         a = 1j
   109:         b = {2, 3}
-->110:         result = a * b

a: 1j
b: {2, 3}

TypeError - 4a: unsupported operand type(s) for *=

Python exception:
    TypeError: unsupported operand type(s) for *=: 'set' and 'complex'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to multiply two incompatible types of objects:
    a set and a complex number

Execution stopped on line 124 of file 'TESTS:\except\test_type_error.py'.

   122:         a = 1j
   123:         b = {2, 3}
-->124:         b *= a

b: {2, 3}
a: 1j

TypeError - 5: unsupported operand type(s) for /

Python exception:
    TypeError: unsupported operand type(s) for /: 'dict' and 'float'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to divide two incompatible types of objects:
    a dictionary ('dict') and a number ('float')

Execution stopped on line 138 of file 'TESTS:\except\test_type_error.py'.

   136:         a = {1: 1, 2: 2}
   137:         b = 3.1416
-->138:         result = a / b

a: {1: 1, 2: 2}
b: 3.1416

TypeError - 5a: unsupported operand type(s) for /=

Python exception:
    TypeError: unsupported operand type(s) for /=: 'float' and 'dict'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to divide two incompatible types of objects:
    a number ('float') and a dictionary ('dict')

Execution stopped on line 152 of file 'TESTS:\except\test_type_error.py'.

   150:         a = {1: 1, 2: 2}
   151:         b = 3.1416
-->152:         b /= a

b: 3.1416
a: {1: 1, 2: 2}

TypeError - 5b: unsupported operand type(s) for //

Python exception:
    TypeError: unsupported operand type(s) for //: 'dict' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to divide two incompatible types of objects:
    a dictionary ('dict') and an integer ('int')

Execution stopped on line 166 of file 'TESTS:\except\test_type_error.py'.

   164:         a = {1: 1, 2: 2}
   165:         b = 1
-->166:         result = a // b

a: {1: 1, 2: 2}
b: 1

TypeError - 5c: unsupported operand type(s) for //=

Python exception:
    TypeError: unsupported operand type(s) for //=: 'float' and 'dict'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to divide two incompatible types of objects:
    a number ('float') and a dictionary ('dict')

Execution stopped on line 180 of file 'TESTS:\except\test_type_error.py'.

   178:         a = {1: 1, 2: 2}
   179:         b = 3.1416
-->180:         b //= a

b: 3.1416
a: {1: 1, 2: 2}

TypeError - 6: unsupported operand type(s) for &

Python exception:
    TypeError: unsupported operand type(s) for &: 'str' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to perform the bitwise operation &
    on two incompatible types of objects:
    a string ('str') and an integer ('int')

Execution stopped on line 194 of file 'TESTS:\except\test_type_error.py'.

   192:         a = "a"
   193:         b = 2
-->194:         result = a & b

a: 'a'
b: 2

TypeError - 6a: unsupported operand type(s) for &=

Python exception:
    TypeError: unsupported operand type(s) for &=: 'int' and 'str'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to perform the bitwise operation &=
    on two incompatible types of objects:
    an integer ('int') and a string ('str')

Execution stopped on line 208 of file 'TESTS:\except\test_type_error.py'.

   206:         a = "a"
   207:         b = 2
-->208:         b &= a

b: 2
a: 'a'

TypeError - 7: unsupported operand type(s) for **

Python exception:
    TypeError: unsupported operand type(s) for ** or pow(): 'dict' and 'float'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to exponentiate (raise to a power)
    using two incompatible types of objects:
    a dictionary ('dict') and a number ('float')

Execution stopped on line 222 of file 'TESTS:\except\test_type_error.py'.

   220:         a = {1: 1, 2: 2}
   221:         b = 3.1416
-->222:         result = a ** b

a: {1: 1, 2: 2}
b: 3.1416

TypeError - 7a: unsupported operand type(s) for **=

Python exception:
    TypeError: unsupported operand type(s) for ** or pow(): 'dict' and 'float'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to exponentiate (raise to a power)
    using two incompatible types of objects:
    a dictionary ('dict') and a number ('float')

Execution stopped on line 236 of file 'TESTS:\except\test_type_error.py'.

   234:         a = {1: 1, 2: 2}
   235:         b = 3.1416
-->236:         a **= b

a: {1: 1, 2: 2}
b: 3.1416

TypeError - 8: unsupported operand type(s) for >>

Python exception:
    TypeError: unsupported operand type(s) for >>: 'str' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to perform the bit shifting operation >>
    on two incompatible types of objects:
    a string ('str') and an integer ('int')

Execution stopped on line 250 of file 'TESTS:\except\test_type_error.py'.

   248:         a = "a"
   249:         b = 42
-->250:         result = a >> b

a: 'a'
b: 42

TypeError - 8a: unsupported operand type(s) for >>=

Python exception:
    TypeError: unsupported operand type(s) for >>=: 'str' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to perform the bit shifting operation >>=
    on two incompatible types of objects:
    a string ('str') and an integer ('int')

Execution stopped on line 264 of file 'TESTS:\except\test_type_error.py'.

   262:         a = "a"
   263:         b = 42
-->264:         a >>= b

a: 'a'
b: 42

TypeError - 9: unsupported operand type(s) for @

Python exception:
    TypeError: unsupported operand type(s) for @: 'str' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to use the operator @
    using two incompatible types of objects:
    a string ('str') and an integer ('int').
    This operator is normally used only
    for multiplication of matrices.

Execution stopped on line 278 of file 'TESTS:\except\test_type_error.py'.

   276:         a = "a"
   277:         b = 2
-->278:         result = a @ b

a: 'a'
b: 2

TypeError - 9a: unsupported operand type(s) for @=

Python exception:
    TypeError: unsupported operand type(s) for @=: 'str' and 'int'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to use the operator @=
    using two incompatible types of objects:
    a string ('str') and an integer ('int').
    This operator is normally used only
    for multiplication of matrices.

Execution stopped on line 292 of file 'TESTS:\except\test_type_error.py'.

   290:         a = "a"
   291:         b = 2
-->292:         a @= b

a: 'a'
b: 2

TypeError - 10: comparison between incompatible types

Python exception:
    TypeError: '<' not supported between instances of 'int' and 'str'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to do an order comparison (<)
    between two incompatible types of objects:
    an integer ('int') and a string ('str')

Execution stopped on line 306 of file 'TESTS:\except\test_type_error.py'.

   304:         a = "a"
   305:         b = 42
-->306:         b < a

b: 42
a: 'a'

TypeError - 11: bad operand type for unary +

Python exception:
    TypeError: bad operand type for unary +: 'str'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to use the unary operator '+'
    with the following type of object: a string ('str').
    This operation is not defined for this type of object.

Execution stopped on line 318 of file 'TESTS:\except\test_type_error.py'.

   316: def test_type_error11():
   317:     try:
-->318:         a = +"abc"

TypeError - 11a: bad operand type for unary -

Python exception:
    TypeError: bad operand type for unary -: 'list'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to use the unary operator '-'
    with the following type of object: a list.
    This operation is not defined for this type of object.

Execution stopped on line 331 of file 'TESTS:\except\test_type_error.py'.

   329: def test_type_error11a():
   330:     try:
-->331:         a = -[1, 2, 3]

TypeError - 11b: bad operand type for unary ~

Python exception:
    TypeError: bad operand type for unary ~: 'tuple'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You tried to use the unary operator '~'
    with the following type of object: a tuple.
    This operation is not defined for this type of object.

Execution stopped on line 344 of file 'TESTS:\except\test_type_error.py'.

   342: def test_type_error11b():
   343:     try:
-->344:         a = ~(1, 2, 3)

TypeError - 12: object does not support item assignment

Python exception:
    TypeError: 'tuple' object does not support item assignment

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    In Python, some objects are known as immutable:
    once defined, their value cannot be changed.
    You tried change part of such an immutable object: a tuple,
    most likely by using an indexing operation.

Execution stopped on line 358 of file 'TESTS:\except\test_type_error.py'.

   356:     a = (1, 2, 3)
   357:     try:
-->358:         a[0] = 0

a: (1, 2, 3)

TypeError - 13: wrong number of positional arguments

Python exception:
    TypeError: fn() takes 0 positional arguments but 1 was given

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You apparently have called the function 'fn()' with
    1 positional argument while it requires 0
    such positional arguments.

Execution stopped on line 373 of file 'TESTS:\except\test_type_error.py'.

   371:
   372:     try:
-->373:         fn(1)

fn: <function test_type_error13.<locals>.fn>

TypeError - 14: missing positional arguments

Python exception:
    TypeError: fn() missing 2 required positional arguments: 'b' and 'c'

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    You apparently have called the function 'fn()' with
    fewer positional arguments than it requires (2 missing).

Execution stopped on line 388 of file 'TESTS:\except\test_type_error.py'.

   386:
   387:     try:
-->388:         fn(1)

fn: <function test_type_error14.<locals>.fn>

TypeError - 15: tuple object is not callable

Python exception:
    TypeError: 'tuple' object is not callable

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    I suspect that you had an object of this type, <a tuple>,
    followed by what looked like a tuple, '(...)',
    which Python took as an indication of a function call.
    Perhaps you had a missing comma before the tuple.

Execution stopped on line 400 of file 'TESTS:\except\test_type_error.py'.

   398: def test_type_error15():
   399:     try:
-->400:         _ = (1, 2)(3, 4)

TypeError - 15a: list object is not callable

Python exception:
    TypeError: 'list' object is not callable

A TypeError is usually caused by trying
to combine two incompatible types of objects,
by calling a function with the wrong type of object,
or by tring to do an operation not allowed on a given type of object.

Likely cause based on the information given by Python:
    I suspect that you had an object of this type, <a list>,
    followed by what looked like a tuple, '(...)',
    which Python took as an indication of a function call.
    Perhaps you had a missing comma before the tuple.

Execution stopped on line 412 of file 'TESTS:\except\test_type_error.py'.

   410: def test_type_error15a():
   411:     try:
-->412:         _ = [1, 2](3, 4)

UnboundLocalError

Python exception:
    UnboundLocalError: local variable 'a' referenced before assignment

In Python, variables that are used inside a function are known as
local variables. Before they are used, they must be assigned a value.
A variable that is used before it is assigned a value is assumed to
be defined outside that function; it is known as a 'global'
(or sometimes 'nonlocal') variable. You cannot assign a value to such
a global variable inside a function without first indicating to
Python that this is a global variable, otherwise you will see
an UnboundLocalError.

Likely cause based on the information given by Python:
    The variable that appears to cause the problem is 'a'.
    Perhaps the statement
        global a
    should have been included as the first line inside your function.

Execution stopped on line 21 of file 'TESTS:\except\test_unbound_local_error.py'.

   19:
   20:     try:
-->21:         outer()

global outer: <function outer>

Exception raised on line 12 of file 'TESTS:\except\test_unbound_local_error.py'.

   10:     def inner():
   11:         c = 3
-->12:         a = a + b + c

global b: 2
c: 3

Unknown exception

Python exception:
    MyException: Some informative message about an unknown exception.

No information is known about this exception.
Please report this example to
https://github.com/aroberge/friendly-traceback/issues

Execution stopped on line 10 of file 'TESTS:\except\test_unknown_error.py'.

    8: def test_unknown_error():
    9:     try:
-->10:         raise MyException("Some informative message about an unknown exception.")

global MyException: <class 'test_unknown_error.MyException'>

ZeroDivisionError - 1

Python exception:
    ZeroDivisionError: division by zero

A ZeroDivisionError occurs when you are attempting to divide
a value by zero:
    result = my_variable / 0
It can also happen if you calculate the remainder of a division
using the modulo operator '%'
    result = my_variable % 0

Execution stopped on line 6 of file 'TESTS:\except\test_zero_division_error.py'.

   4: def test_zero_division_error():
   5:     try:
-->6:         1 / 0

ZeroDivisionError - 2

Python exception:
    ZeroDivisionError: integer division or modulo by zero

A ZeroDivisionError occurs when you are attempting to divide
a value by zero:
    result = my_variable / 0
It can also happen if you calculate the remainder of a division
using the modulo operator '%'
    result = my_variable % 0

Execution stopped on line 19 of file 'TESTS:\except\test_zero_division_error.py'.

   17:     zero = 0
   18:     try:
-->19:         1 % zero

zero: 0