Understanding tracebacks.
WHAT A TRACEBACK IS
A record of where the error occurred and how the code reached that point.
HOW TO READ IT
From the bottom.
The last line states the error type and message.
WHAT THE LINES ABOVE SHOW
The path of calls leading there, most recent last.
WHAT TO LOOK FOR
The last line referring to your own code.
That is usually where the problem is, even when the error occurs deeper.
COMMON ERROR TYPES
A name that does not exist An attribute that does not exist on an object A type used where another was expected A key or index that is not present A value of the right type but wrong content A file not found A division by zero
WHAT EACH USUALLY MEANS
A typo An assumption about what something is Data not in the expected shape
WHAT TO DO
Read the message literally. It is usually precise.
WHAT NOT TO DO
Change things until it stops complaining.