Python
Python errors and exceptions explained in plain English.
Find your error below for a clear explanation and how to fix it.
Error Codes
KeyboardInterrupt
Python
Python
KeyboardInterrupt is raised when you press Ctrl+C while a Python program is …
ChildProcessError
Python
Programming Language
A ChildProcessError means a system-level operation on a child process …
ConnectionRefusedError
Python
Programming Language
A ConnectionRefusedError means your Python code tried to connect to a server …
ConnectionResetError
Python
Programming Language
A ConnectionResetError means you had an open network connection and the other …
FileExistsError
Python
Programming Language
A FileExistsError means your Python code tried to create a file or directory, …
InterruptedError
Python
Programming Language
An InterruptedError means a low-level system call (like reading from a socket or …
IsADirectoryError
Python
Programming Language
An IsADirectoryError means your Python code tried to perform a file operation …
ProcessLookupError
Python
Programming Language
A ProcessLookupError means your Python code tried to interact with a process …
TabError
Python
Programming Language
A TabError means Python found a mix of tab characters and space characters used …
UnboundLocalError
Python
Programming Language
An UnboundLocalError means you used a variable inside a function before giving …
UnicodeTranslateError
Python
Programming Language
A UnicodeTranslateError means Python tried to translate (convert) a Unicode …
ArithmeticError
Python
Programming Language
ArithmeticError is the parent class for errors caused by math operations going …
AssertionError
Python
Programming Language
AssertionError means an assert statement in your code evaluated to …
AttributeError
Python
Programming Language
An AttributeError means you tried to access a property or method that does not …
BlockingIOError
Python
Programming Language
BlockingIOError means your code tried to do an I/O operation — like reading from …
BrokenPipeError
Python
Programming Language
BrokenPipeError means your Python script tried to write data to a pipe or …
BufferError
Python
Programming Language
BufferError is raised when something goes wrong with a buffer operation.<br>A …
ConnectionError
Python
Programming Language
A ConnectionError means Python tried to connect to a network address — like a …
EnvironmentError
Python
Programming Language
EnvironmentError is an older name for OSError in Python.<br>It is raised when …
EOFError
Python
Programming Language
EOFError stands for End-Of-File Error.<br>It happens when Python's input() …
FileNotFoundError
Python
Programming Language
A FileNotFoundError means Python tried to open or access a file, but could not …
GeneratorExit
Python
Programming Language
GeneratorExit is raised inside a generator function when it is closed with …
ImportError
Python
Programming Language
An ImportError means Python found the module you are trying to import, but …
IndentationError
Python
Programming Language
An IndentationError means the spacing at the start of a line is wrong.<br>Python …
IndexError
Python
Programming Language
An IndexError means you tried to access an item in a list (or other sequence) …
KeyError
Python
Programming Language
A KeyError means you tried to look up a key in a dictionary that does not …
LookupError
Python
Programming Language
LookupError is the base class for errors that happen when you try to look …
MemoryError
Python
Programming Language
A MemoryError means Python tried to allocate more memory than your computer has …
ModuleNotFoundError
Python
Programming Language
A ModuleNotFoundError means Python cannot find the module (library or package) …
NameError
Python
Programming Language
A NameError means Python found a name (a variable, function, or class) that it …
NotADirectoryError
Python
Programming Language
NotADirectoryError happens when your code tries to use a file path as if it were …
NotImplementedError
Python
Programming Language
NotImplementedError means you called a method that is defined in a base class …
OSError
Python
Programming Language
OSError means your Python code tried to do something with the operating system — …
OverflowError
Python
Programming Language
OverflowError means a numeric calculation produced a result too large for Python …
PermissionError
Python
Programming Language
A PermissionError means your Python program tried to access a file, folder, or …
RecursionError
Python
Programming Language
A RecursionError means a function called itself so many times that Python ran …
RuntimeError
Python
Programming Language
A RuntimeError is a general-purpose error that Python raises when something goes …
StopIteration
Python
Programming Language
StopIteration is a signal that an iterator has run out of items to give …
SyntaxError
Python
Programming Language
A SyntaxError means Python found something in your code that it cannot …
SystemError
Python
Programming Language
A Python SystemError means something went wrong inside the Python interpreter …
SystemExit
Python
Programming Language
SystemExit is raised when your program calls sys.exit().<br>It is not a bug — it …
TimeoutError
Python
Programming Language
A TimeoutError means an operation started but did not finish within the allowed …
TypeError
Python
Programming Language
A TypeError means you tried to use a value in a way that does not match its …
UnicodeDecodeError
Python
Programming Language
A UnicodeDecodeError means Python tried to read text from a file or data source …
UnicodeEncodeError
Python
Programming Language
UnicodeEncodeError happens when Python tries to convert text (a string) into …
UnicodeError
Python
Programming Language
A Python UnicodeError means Python encountered a text character it could not …
ValueError
Python
Programming Language
A ValueError means you gave a function a value of the right type, but the value …
Warning
Python
Programming Language
A Python Warning is not an error — your code keeps running.<br>It is Python's …
ZeroDivisionError
Python
Programming Language
A ZeroDivisionError means your code tried to divide a number by …