How should I read an error message to fix the code that caused it?


If I see an error message in the terminal, how should I go about reading through it and fixing the issue that caused it?


In Python, and many other programming languages, it’s best to start with the bottom-most error message in the terminal window. Most of the time you’ll get a handful of useful information with an error message:

  1. The line number where the issue is,

  2. A ^ pointing to the spot where it thinks the issue may be,

  3. An error name, like IndentationError,

  4. And if you’re lucky, a suggestion of how to fix it!

It should be noted, though, that these are not always accurate, as the computer can only do its best to parse through code to identify issues.