How to Read a Python Traceback (Most Read It Backwards)
The last line tells you what broke. The middle tells you why. Here is how to get a working hypothesis out of a traceback in about ten seconds.
| Exception | Usually means |
|---|---|
AttributeError: 'NoneType' object has no attribute 'x' |
Something returned None on a path you did not expect |
KeyError |
The data shape differs from your assumption |
TypeError |
Wrong type, often a genuine code bug |
ValueError |
Right type, bad value, usually bad input data |
RecursionError |
A cycle in your data, or a missing base case |
Related reading: Debugging asyncio Deadlocks and the Blocking Call Checklist explores a connected angle.
Related reading: ModuleNotFoundError Even Though You Definitely Installed It explores a connected angle.
Published on debugly.dev by Rohit Bhadani | Founder of Krova Cloud