๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ errors.html
8. Errors and Exceptions โ€” Python 3.14.7 documentation
Exceptions come in different types, and the type is printed as part of the message: the types in the example are ZeroDivisionError, NameError and TypeError. The string printed as the exception type is the name of the built-in exception that occurred.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_ref_exceptions.asp
Python Built-in Exceptions
The table below shows built-in exceptions that are usually raised in Python.
People also ask

What are some common types of exceptions in Python?
Some common types of exceptions in Python include ValueError, ZeroDivisionError, TypeError, IndexError, and FileNotFoundError. Each tells you something specific went wrong in your program.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ exception-handling
Exception Handling in Python: All Types With Examples
How do I handle exceptions in Python?
You can handle exceptions in Python using try and except blocks. Put your risky code in try, and write how you want to handle specific errors in the except block.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ exception-handling
Exception Handling in Python: All Types With Examples
What is Python Exception Handling, and why should I use it?
Python Exception Handling allows you to catch and manage errors in your code. You should use it to prevent your program from crashing and to handle problems more smoothly and professionally.
๐ŸŒ
wscubetech.com
wscubetech.com โ€บ resources โ€บ python โ€บ exception-handling
Exception Handling in Python: All Types With Examples
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ builtins โ€บ exceptions.html
Built-in Exceptions โ€” Python 3.14.7 documentation
If an object is meant to support a given operation but has not yet provided an implementation, NotImplementedError is the proper exception to raise. Passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in a TypeError, but passing arguments with the wrong value (e.g.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ exceptions
Python Exceptions (With Examples)
We can handle these built-in and ... and finally statements. Errors represent conditions such as compilation error, syntax error, error in the logical part of the code, library incompatibility, infinite recursion, etc....
๐ŸŒ
Dataquest
dataquest.io โ€บ home โ€บ blog โ€บ python exceptions: the ultimate beginner's guide (with examples)
Python Exceptions: The Ultimate Beginner's Guide (with Examples)
March 6, 2023 - The parser shows the place where the syntax error was detected by a little arrow ^. Notice also that the subsequent line print(1) was not executed since the Python interpreter stopped working when the error occurred. ... --------------------------------------------------------------------------- NameError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_4732/971139432.py in <module> ----> 1 print(x) 2 print(1) NameError: name 'x' is not defined ยท Now when we have fixed the wrong syntax, we got another type of error: an exception.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ built-exceptions-python
Python Built-in Exceptions - GeeksforGeeks
Raised when a system-related operation (like file I/O, opening files, or interacting with the OS) fails. In Python 3: IOError is just an alias for OSError (they are the same). FileNotFoundError is a subclass of OSError, specifically raised when a file or directory does not exist. Example: This example attempts to open a missing file, which triggers FileNotFoundError (a subclass of OSError). ... try: open("non_existent_file.txt") # File does not exist except FileNotFoundError as e: # More specific print("FileNotFoundError caught:", e) except OSError as e: # General OS-related error print("OSError caught:", e)
Published: April 18, 2026
๐ŸŒ
WsCube Tech
wscubetech.com โ€บ resources โ€บ python โ€บ exception-handling
Exception Handling in Python: All Types With Examples
August 6, 2026 - Explore Python exception handling with examples. Learn exception handling, types of exceptions & the advantages & disadvantages of exception handling. Read now.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ exception-handling-python
Exception & Error Handling in Python | Tutorial by DataCamp | DataCamp
May 29, 2026 - An exception, on the other hand, is a condition that interrupts the program's normal flow but can be handled within the program using try-except blocks, allowing the program to continue executing. Yes, Python allows you to catch multiple exceptions in a single try-except block by using a tuple of exception types. For example: except (TypeError, ValueError):. This will handle either a TypeError or a ValueError in the same block.
Find elsewhere
๐ŸŒ
Tutorial Teacher
tutorialsteacher.com โ€บ python โ€บ error-types-in-python
Error Types in Python
Learn about built-in error types in Python such as IndexError, NameError, KeyError, ImportError, etc.
๐ŸŒ
Toppr
toppr.com โ€บ guides โ€บ python-guide โ€บ tutorials โ€บ python-files โ€บ python-errors-and-built-in-exceptions
Python Errors and Built-in Exceptions | Different types of errors in Python |
October 21, 2021 - For example, they occur when we attempt to open (read) a file that does not exist (FileNotFoundError), divide an integer by zero (ZeroDivisionError), or import a module that does not exist (ImportError). Python generates an exception object if these types of runtime issues occur.
๐ŸŒ
Real Python
realpython.com โ€บ python-exceptions
Python Exceptions: An Introduction โ€“ Real Python
March 18, 2026 - In the Python docs, you can see that there are a couple of built-in exceptions that you could raise in such a situation, for example: ... Raised when a file or directory is requested but doesnโ€™t exist. Corresponds to errno ENOENT. (Source) You want to handle the situation when Python canโ€™t find the requested file. To catch this type of exception and print it to screen, you could use the following code: ... try: with open("file.log") as file: read_data = file.read() except FileNotFoundError as fnf_error: print(fnf_error)
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-exception-handling
Python Exception Handling - GeeksforGeeks
The bare except catches it, but this can make debugging harder since the actual error type is hidden. Use bare except only as a net. We raise an exception using the raise keyword followed by an instance of the exception class that we want to trigger. We can choose from built-in exceptions or define our own custom exceptions by inheriting from Python's built-in Exception class. ... Example: This code raises a ValueError if an invalid age is given.
Published: May 29, 2026
๐ŸŒ
Sentry
blog.sentry.io โ€บ practical-tips-on-handling-errors-and-exceptions-in-python
Guide to Errors vs Exceptions in Python | Sentry Blog
April 1, 2025 - Letโ€™s take a look at some of the most common exceptions youโ€™ll encounter. TypeError: Raised when an operation is performed on incompatible types, such as trying to add a string and an integer.
๐ŸŒ
Real Python
realpython.com โ€บ python-built-in-exceptions
Python's Built-in Exceptions: A Walkthrough With Examples โ€“ Real Python
March 18, 2026 - The IndexError and ValueError exceptions are examples of commonly used built-in exceptions in Python. In the following sections, youโ€™ll learn more about these and several other built-in exceptions.
๐ŸŒ
Scientech Easy
scientecheasy.com โ€บ home โ€บ blog โ€บ types of exception in python
Types of Exception in Python - Scientech Easy
January 29, 2026 - In this example, the div() function attempts to perform division on the arguments a and b. However, the first argument passed to the function is a string โ€œ10โ€, and the second argument is an integer 2. Attempting to divide a string by an integer results in a TypeError in Python because string division with an integer is not supported. The ValueError exception occurs when a built-in operation or function expects an argument of correct data type but receives an inappropriate or invalid value for that operation.
๐ŸŒ
Honeybadger
honeybadger.io โ€บ blog โ€บ a-guide-to-exception-handling-in-python
The ultimate guide to Python exception handling - Honeybadger Developer Blog
March 28, 2025 - Exceptions can occur for various ... conditions. Examples of exceptions in Python include ZeroDivisionError, TypeError, FileNotFoundError, and ValueError, among others....
๐ŸŒ
Runestone Academy
runestone.academy โ€บ ns โ€บ books โ€บ published โ€บ fopp โ€บ Exceptions โ€บ standard-exceptions.html
19.4. Standard Exceptions โ€” Foundations of Python Programming
Most of the standard exceptions built into Python are listed below. They are organized into related groups based on the types of issues they deal with. All exceptions are objects. The classes that define the objects are organized in a hierarchy, which is shown below. This is important because the parent class of a set of related exceptions will catch all exception messages for itself and its child exceptions. For example, an ArithmeticError exception will catch itself and all FloatingPointError, OverflowError, and ZeroDivisionError exceptions.
๐ŸŒ
LearnPython.com
learnpython.com โ€บ blog โ€บ python-exceptions
A Brief Guide to Python Exceptions | LearnPython.com
October 29, 2022 - If you run into this Python exception, the solution is to search for syntax errors in your code and fix them. This exception indicates that you tried to perform an operation using the wrong data type. As the following example demonstrates, you cannot โ€œaddโ€ a number and a string: value = 5 name = 'John' print(value + name) # TypeError: unsupported operand type(s) for +: 'int' and 'str' This exception often appears when you try to perform an operation with a None value โ€“ which is a type that accepts no operations.
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-use-python-exception-types-420056
How to use Python exception types | LabEx
At LabEx, we emphasize the importance of understanding and effectively using exception handling to write more resilient Python applications. Python provides several mechanisms to handle exceptions effectively: try: ## Code that might raise an exception result = risky_operation() except ExceptionType: ## Handle specific exception handle_error() def process_data(data): try: ## Multiple potential exception scenarios value = int(data) result = 100 / value except ValueError: print("Invalid data type") except ZeroDivisionError: print("Cannot divide by zero")
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_try_except.asp
Python Try Except
The finally block lets you execute code, regardless of the result of the try- and except blocks. ... When an error occurs, or exception as we call it, Python will normally stop and generate an error message. These exceptions can be handled using the try statement: The try block will generate an exception, because x is not defined: try: print(x) except: print("An exception occurred") Try it Yourself ยป ยท Since the try block raises an error, the except block will be executed. Without the try block, the program will crash and raise an error: