{"id":257,"date":"2023-02-10T11:10:58","date_gmt":"2023-02-10T11:10:58","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/?page_id=257"},"modified":"2023-04-17T13:16:59","modified_gmt":"2023-04-17T12:16:59","slug":"errors","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-1\/errors\/","title":{"rendered":"Errors"},"content":{"rendered":"\n<p>You are going to make errors. <\/p>\n\n\n\n<p>Your tutor is likely to make errors while typing too. <\/p>\n\n\n\n<p><strong>Don&#8217;t worry about errors. <\/strong>Just learn to fix them.<\/p>\n\n\n\n<p>When an error happens there will be some text the helps you find what went wrong.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"103\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111359\/error1-1024x103.png\" alt=\"A type error in Replit\" class=\"wp-image-261\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111359\/error1-1024x103.png 1024w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111359\/error1-300x30.png 300w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111359\/error1-768x77.png 768w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111359\/error1.png 1260w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Here we can see a Type Error happening. The code tried to concatenate an integer onto a string and the print function was not happy about it. But notice how it tries to help you. First it tells you the line that caused the problem, in this case line 2. And then it explains what the issue is. In this case it says:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>can only concatenate str (not \"int\") to str<\/code><\/pre>\n\n\n\n<p>In IDLE depending on the version it might say:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>must be str, not int<\/code><\/pre>\n\n\n\n<p>But both are telling you what went wrong.<\/p>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"85\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111840\/error2-1024x85.png\" alt=\"A Syntax error in Replit\" class=\"wp-image-262\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111840\/error2-1024x85.png 1024w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111840\/error2-300x25.png 300w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111840\/error2-768x63.png 768w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/02\/10111840\/error2.png 1260w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In this image we see a syntax error.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unexpected EOF while parsing<\/code><\/pre>\n\n\n\n<p>EOF means End Of File. This means python reached the end of the file but was still expecting something. If you look closely you can see that there are two opening brackets on the print line, but only one closing one. The end of the file was reached and python was still waiting for that second closing bracket.<\/p>\n\n\n\n<p>This error is harder to find as the line number shown is just the end of the file. Python doesn&#8217;t know where you missed the bracket.<\/p>\n\n\n\n<p class=\"nextlink\"><a href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-1\/coding-conventions\/\" data-type=\"page\" data-id=\"264\">Next: Coding conventions<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You are going to make errors. Your tutor is likely to make errors while typing too. Don&#8217;t worry about errors. Just learn to fix them. When an error happens there will be some text the helps you find what went wrong. Here we can see a Type Error happening. The code tried to concatenate an&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/software-design-and-development\/week-1\/errors\/\">Continue reading <span class=\"screen-reader-text\">Errors<\/span><\/a><\/p>\n","protected":false},"author":5710,"featured_media":0,"parent":14,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-257","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/users\/5710"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/comments?post=257"}],"version-history":[{"count":4,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/257\/revisions"}],"predecessor-version":[{"id":1314,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/257\/revisions\/1314"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/14"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/media?parent=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}