CertGrid CertGrid
Concepts·Certified Entry-Level Python Programmer

Python Exception Hierarchy

PCEP objective 4.3 is titled Python Built-In Exceptions Hierarchy, and it is one of the few objectives that really is a memorisation task. It is much less work than it looks: the tree has three or four levels, most exceptions sit directly under Exception, and the ones that do not are grouped in ways that make sense. This page prints the whole thing out of the interpreter rather than drawing it, because every diagram in circulation gets at least one relationship wrong.

Exceptions Guide 23 of 26 Intermediate

The hierarchy is stable. ModuleNotFoundError was added in Python 3.6 as a subclass of ImportError, and BaseExceptionGroup in 3.11 - neither exam examines the second. RecursionError was split out of RuntimeError in 3.5 and remains a subclass of it.

One machine, and any shell with Python 3 will do - these exams test the language, not a distribution.
Server NameIP AddressOSRolesCPURAMHDD
RUNNER01192.168.0.27Ubuntu 26.04 LTSPython 3.14.4 - the only machine this path needs2 Core4 GB50 GB

This guide includes

Use this for the exception-hierarchy objective, the most directly memorisable material on PCEP. This matters because inheritance decides which except clause matches - so a class's parents tell you what will catch it.

Before you start

  1. The tree, printed from the classes themselves

  2. What sits directly under BaseException

  3. Inheritance decides which clause matches

  4. The shape worth memorising

  5. What the exam does with this objective

Official sources