Game Development Reference
In-Depth Information
Error messages in Python can often be confusing. Here is a list of common error
messages you may find, along with a plain English explanation. These error messages are
the result of runtime errors. They will immediately crash your Here are the error messages
explained (your error messages may be slightly different but mean the same thing):
SyntaxError: invalid syntax
ImportError: No module named raandom
SyntaxError: EOL while scanning string literal
AttributeError: 'str' object has no attribute 'lowerr'
IndentationError: expected an indented block
IndentationError: unexpected indent
IndentationError: unindent does not match any outer indentation level
TypeError: bad operand type for abs(): 'str'
TypeError: abs() takes exactly one argument (2 given)
IndexError: list index out of range
KeyError: 'spam'
SyntaxError: invalid syntax
This is the most generic error message the Python interpreter will give you. It means that
Python was expecting something that isn't there, or there is something there that it didn't
expect. Maybe you forgot to include or inserted an extra character. Here are some
examples:
if guess = 5: