{"id":107948,"date":"2020-12-09T10:00:00","date_gmt":"2020-12-09T08:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=107948"},"modified":"2020-12-07T15:37:22","modified_gmt":"2020-12-07T13:37:22","slug":"python-errors-and-built-in-exceptions","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html","title":{"rendered":"Python Errors and Built-in Exceptions"},"content":{"rendered":"<p>Hello in this tutorial, we will understand errors and built-in exceptions in python programming.<\/p>\n<h2>1. Introduction<\/h2>\n<h3>1.1 Error<\/h3>\n<p>A typing mistake can lead to a fault in the programming language because of the syntax rules while coding is known as an error or popularly known as the syntax error. A syntax error is the most common situation where you break any syntax rule. The snippet below is a good example of a syntax error where we missed to specify the colon at the end of the <code>if<\/code> condition.<\/p>\n<div>\n<div id=\"highlighter_603240\" class=\"syntaxhighlighter  python\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python comments\"># Syntax error<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"python comments\"># Reason - Invalid syntax as you have not added colon (:) at the end of if condition.<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python keyword\">if<\/code> <code class=\"python value\">7<\/code> <code class=\"python plain\">&gt; <\/code><code class=\"python value\">5<\/code><code class=\"python plain\">:<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"python spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"python functions\">print<\/code><code class=\"python plain\">(<\/code><code class=\"python string\">'True'<\/code><code class=\"python plain\">)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>1.2 Exceptions<\/h3>\n<p>An exception is considered as an unusual condition in a program that breaks the program flow due to an interruption. When an exception occurs, the program stops, and the further code is not executed and thus they are also known as the run-time errors. An exception in python is an object that represents the error and <code>Exception<\/code> is python is known as the base class for all exceptions. The table below lists the built-in exception that usually occurs in python programming.<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\"><strong>Exception<\/strong><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>ArithmeticError<\/code><\/td>\n<td>Raised when an error occurs in numeric calculations<\/td>\n<\/tr>\n<tr>\n<td><code>AssertionError<\/code><\/td>\n<td>Raised when an assert statement fails<\/td>\n<\/tr>\n<tr>\n<td><code>AttributeError<\/code><\/td>\n<td>Raised when attribute reference or assignment fails<\/td>\n<\/tr>\n<tr>\n<td><code>EOFError<\/code><\/td>\n<td>Raised when the <code>input()<\/code> method hits an end of file condition<\/td>\n<\/tr>\n<tr>\n<td><code>FloatingPointError<\/code><\/td>\n<td>Raised when a floating-point calculation fails<\/td>\n<\/tr>\n<tr>\n<td><code>ImportError<\/code><\/td>\n<td>Raised when an imported module does not exist<\/td>\n<\/tr>\n<tr>\n<td><code>IndentationError<\/code><\/td>\n<td>Raised when indentation is not correct<\/td>\n<\/tr>\n<tr>\n<td><code>IndexError<\/code><\/td>\n<td>Raised when an index of a sequence does not exist<\/td>\n<\/tr>\n<tr>\n<td><code>KeyError<\/code><\/td>\n<td>Raised when a key does not exist in a dictionary<\/td>\n<\/tr>\n<tr>\n<td><code>MemoryError<\/code><\/td>\n<td>Raised when a program runs out of memory<\/td>\n<\/tr>\n<tr>\n<td><code>NameError<\/code><\/td>\n<td>Raised when a variable does not exist<\/td>\n<\/tr>\n<tr>\n<td><code>NotImplementedError<\/code><\/td>\n<td>Raised when an abstract method requires an inherited class to override the method<\/td>\n<\/tr>\n<tr>\n<td><code>OverflowError<\/code><\/td>\n<td>Raised when the result of a numeric calculation is too large<\/td>\n<\/tr>\n<tr>\n<td><code>ReferenceError<\/code><\/td>\n<td>Raised when a weak reference object does not exist<\/td>\n<\/tr>\n<tr>\n<td><code>RuntimeError<\/code><\/td>\n<td>Raised when an error occurs that does not belong to any specific expectations<\/td>\n<\/tr>\n<tr>\n<td><code>StopIteration<\/code><\/td>\n<td>Raised when the <code>next()<\/code> method of an iterator has no further values<\/td>\n<\/tr>\n<tr>\n<td><code>SyntaxError<\/code><\/td>\n<td>Raised when a syntax error occurs<\/td>\n<\/tr>\n<tr>\n<td><code>TabError<\/code><\/td>\n<td>Raised when indentation consists of tabs or spaces<\/td>\n<\/tr>\n<tr>\n<td><code>SystemError<\/code><\/td>\n<td>Raised when a system error occurs<\/td>\n<\/tr>\n<tr>\n<td><code>SystemExit<\/code><\/td>\n<td>Raised when the <code>sys.exit()<\/code> function is called<\/td>\n<\/tr>\n<tr>\n<td><code>TypeError<\/code><\/td>\n<td>Raised when two different types are combined<\/td>\n<\/tr>\n<tr>\n<td><code>ValueError<\/code><\/td>\n<td>Raised when there is a wrong value in a specified data type<\/td>\n<\/tr>\n<tr>\n<td><code>ZeroDivisionError<\/code><\/td>\n<td>Raised when the second operator in a division is zero<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>1.3 Setting up Python<\/h3>\n<p>If someone needs to go through the Python installation on Windows, please watch <a href=\"https:\/\/www.youtube.com\/watch?v=i-MuSAwgwCU\" target=\"_blank\" rel=\"noopener noreferrer\">this<\/a> link. You can download the Python from <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">this<\/a> link.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>2. Python Errors and Built-in Exceptions<\/h2>\n<p>I am using <a href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\" rel=\"noopener noreferrer\">JetBrains PyCharm<\/a> as my preferred IDE. You are free to choose the IDE of your choice.<\/p>\n<h3>2.1 SyntaxError<\/h3>\n<p>Let us understand this with the help of a code snippet.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>SyntaxError<\/em><\/span><\/p>\n<div>\n<div id=\"highlighter_643091\" class=\"syntaxhighlighter  python\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python comments\"># Syntax error<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"python comments\"># Reason - From Python3 onwards print statement has changed and expects the parenthesis.<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python functions\">print<\/code><code class=\"python plain\">(<\/code><code class=\"python string\">'Hello world from Python!'<\/code><code class=\"python plain\">)<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"python comments\"># Syntax error<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"python comments\"># Reason - Invalid syntax as you have not added colon (:) at the end of if condition.<\/code><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"python keyword\">if<\/code> <code class=\"python value\">7<\/code> <code class=\"python plain\">&gt; <\/code><code class=\"python value\">5<\/code><code class=\"python plain\">:<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"python spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"python functions\">print<\/code><code class=\"python plain\">(<\/code><code class=\"python string\">'True'<\/code><code class=\"python plain\">)<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>If everything goes well the syntax error warnings will be shown in the IDE console.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Console Output<\/em><\/span><\/p>\n<div>\n<div id=\"highlighter_174263\" class=\"syntaxhighlighter  plain\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<div class=\"line number6 index5 alt1\">6<\/div>\n<div class=\"line number7 index6 alt2\">7<\/div>\n<div class=\"line number8 index7 alt1\">8<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">== syntax error ==<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain plain\">print 'Hello world from Python!'<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"plain plain\">^<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Hello world from Python!')?<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><\/div>\n<div class=\"line number6 index5 alt1\"><code class=\"plain plain\">if 7 &gt; 5<\/code><\/div>\n<div class=\"line number7 index6 alt2\"><code class=\"plain spaces\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"plain plain\">^<\/code><\/div>\n<div class=\"line number8 index7 alt1\"><code class=\"plain plain\">SyntaxError: invalid syntax<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>2.2 ZeroDivisionError<\/h3>\n<p>Let us understand this with the help of a code snippet.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>ZeroDivisionError<\/em><\/span><\/p>\n<div>\n<div id=\"highlighter_47728\" class=\"syntaxhighlighter  python\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<div class=\"line number5 index4 alt2\">5<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"python comments\"># Python exception example<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"python plain\">a <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">10<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"python plain\">b <\/code><code class=\"python keyword\">=<\/code> <code class=\"python value\">0<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"python plain\">c <\/code><code class=\"python keyword\">=<\/code> <code class=\"python plain\">a <\/code><code class=\"python keyword\">\/<\/code> <code class=\"python plain\">b<\/code><\/div>\n<div class=\"line number5 index4 alt2\"><code class=\"python functions\">print<\/code><code class=\"python plain\">(<\/code><code class=\"python string\">'Result of division = {}'<\/code><code class=\"python plain\">.<\/code><code class=\"python functions\">format<\/code><code class=\"python plain\">(<\/code><code class=\"python functions\">str<\/code><code class=\"python plain\">(c)))<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>If everything goes well the following error output will be shown in the IDE console.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Console Output<\/em><\/span><\/p>\n<div>\n<div id=\"highlighter_122422\" class=\"syntaxhighlighter  plain\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<div class=\"line number4 index3 alt1\">4<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"plain plain\">Traceback (most recent call last):<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"plain spaces\">&nbsp;&nbsp;<\/code><code class=\"plain plain\">File \"jcg-assignment-python-error-and-exceptions.py\", line 15, in <\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"plain spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"plain plain\">c = a \/ b<\/code><\/div>\n<div class=\"line number4 index3 alt1\"><code class=\"plain plain\">ZeroDivisionError: division by zero<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>That is all for this tutorial and I hope the article served you with whatever you were looking for. Happy Learning and do not forget to share!<\/p>\n<h2>3. Summary<\/h2>\n<p>In this tutorial, we learned:<\/p>\n<ul>\n<li>An introduction to errors and built-in exceptions in python programming<\/li>\n<li>Sample program to understand the errors and built-in exceptions in python programming<\/li>\n<\/ul>\n<p>You can download the source code of this tutorial from the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>4. Download the Project<\/h2>\n<p>This was an example of understanding the errors and built-in exceptions in python programming.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2020\/12\/Python-Errors-and-Built-in-Exceptions.zip\"><strong>Python Errors and Built-in Exceptions<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a fault in the programming language because of the syntax rules while coding is known as an error or popularly known as the syntax error. A syntax error is the most &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":219,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1878],"tags":[224],"class_list":["post-107948","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Errors and Built-in Exceptions - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Errors and Built-in Exceptions - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-09T08:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Python Errors and Built-in Exceptions\",\"datePublished\":\"2020-12-09T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html\"},\"wordCount\":582,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"keywords\":[\"Python\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html\",\"name\":\"Python Errors and Built-in Exceptions - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"datePublished\":\"2020-12-09T08:00:00+00:00\",\"description\":\"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/python-errors-and-built-in-exceptions.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/python\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Python Errors and Built-in Exceptions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Errors and Built-in Exceptions - Java Code Geeks","description":"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html","og_locale":"en_US","og_type":"article","og_title":"Python Errors and Built-in Exceptions - Java Code Geeks","og_description":"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a","og_url":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-12-09T08:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Python Errors and Built-in Exceptions","datePublished":"2020-12-09T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html"},"wordCount":582,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","keywords":["Python"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html","url":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html","name":"Python Errors and Built-in Exceptions - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","datePublished":"2020-12-09T08:00:00+00:00","description":"Hello in this tutorial, we will understand errors and built-in exceptions in python programming. 1. Introduction 1.1 Error A typing mistake can lead to a","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/python-errors-and-built-in-exceptions.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/www.javacodegeeks.com\/category\/web-development"},{"@type":"ListItem","position":3,"name":"Python","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/python"},{"@type":"ListItem","position":4,"name":"Python Errors and Built-in Exceptions"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/107948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=107948"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/107948\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/219"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=107948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=107948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=107948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}