Python79 errors documented

Common Python Errors and How to Fix Them

Browse all documented Python errors with detailed explanations, root causes, and step-by-step fixes.

RuntimeError: Event loop is closed while an asynchronous task is still pending

This error occurs when a Python async function or coroutine is still running when the event loop is closed, typically wh…

Python
Guide

TypeError: 'NoneType' object is not subscriptable

This error occurs when you're trying to access or manipulate a value that is currently set to 'None'. This can happen wh…

Python
Guide

SyntaxError: expected ':', got 'def'

This error occurs when Python expects a colon (:) but instead encounters a different keyword or token, in this case, the…

Python
Guide

SyntaxError: unexpected EOF while parsing

This error occurs when Python encounters the end of the file unexpectedly, indicating that there is a syntax error in th…

Python
Guide

RuntimeError: Cannot schedule new futures after shutdown

This error occurs when you're attempting to use asyncio (a library for concurrent programming in Python) to schedule new…

Python
Guide

SyntaxError: invalid syntax for a while loop in Python 3.x

A syntax error occurs when Python encounters code that it does not understand. In this case, the error is caused by usin…

Python
Guide

sqlite3.OperationalError: no such table: customers

This error occurs when the Python SQLite library is unable to find a table in a database. This can happen if the table w…

Python
Guide

SyntaxError: invalid syntax (<string>, line 3)

This error occurs when Python encounters a line of code that it does not understand. It could be a misplaced operator, a…

Python
Guide

SyntaxError: invalid syntax. expected ==, got =

This error occurs when Python encounters a line of code that it does not understand because of an invalid syntax.…

Python
Guide

SyntaxError: invalid syntax. print statement must be followed by a colon (:)

This error occurs when Python encounters a syntax that doesn't conform to its rules. In this case, the print statement i…

Python
Guide

MemoryError: Unable to allocate 1000 bytes for an array with shape (1000, 1000)

The MemoryError is a runtime error that occurs when the program runs out of memory or when it is unable to allocate memo…

Python
Guide

TemplateNotFound: templates/main.html (template load error)

This error occurs when a template engine in a Python web framework, such as Flask or Django, cannot find the specified t…

Python
Guide

Have a Python error that's not listed? Get an instant explanation.

Explain Another Error