{"id":5646402,"date":"2022-06-13T06:18:20","date_gmt":"2022-06-13T10:18:20","guid":{"rendered":"https:\/\/lightning.ai\/pages\/?p=5646402"},"modified":"2022-09-10T11:13:16","modified_gmt":"2022-09-10T15:13:16","slug":"how-to-debug-python-code","status":"publish","type":"post","link":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/","title":{"rendered":"EP 05: How to Debug Python Code"},"content":{"rendered":"<p>In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb. They discuss breakpoints, variable swapping with the console, and many tips and tricks. Watch the video, or continue reading below.<\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/mD-1OZvuVDU\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2>Debugging Python Code<\/h2>\n<p>Learning and using a professional debugging tool is one of the key things you can do to boost your productivity. Sure, you can often get by with the good old &#8220;<code>print()<\/code>&#8221; statement approach. However, instead of inserting print statements all over your code, it is often more productive to set a breakpoint, jump into the code, and execute it line by line while inspecting the variables.<\/p>\n<h3>Debugging in PyCharm<\/h3>\n<p>In PyCharm, you can launch the debugger by clicking on the &#8220;bug&#8221; symbol in the upper right corner:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646404 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug.png\" alt=\"PyCharm debug\" width=\"1878\" height=\"1236\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug.png 1878w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-300x197.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-1024x674.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-768x505.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-1536x1011.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-600x395.png 600w\" sizes=\"(max-width: 1878px) 100vw, 1878px\" \/><\/p>\n<p>Then, you can set a breakpoint by clicking next to the line number: a red dot should appear:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646406 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint.png\" alt=\"PyCharm breakpoint\" width=\"1878\" height=\"1236\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint.png 1878w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint-300x197.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint-1024x674.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint-768x505.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint-1536x1011.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-breakpoint-600x395.png 600w\" sizes=\"(max-width: 1878px) 100vw, 1878px\" \/><\/p>\n<p>Now, if you run the debugger again, the code should stop at the breakpoint, and you should see the variable contents and so forth:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646407 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents.png\" alt=\"PyCharm debug with variable contents\" width=\"1878\" height=\"1236\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents.png 1878w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents-300x197.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents-1024x674.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents-768x505.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents-1536x1011.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-variable-contents-600x395.png 600w\" sizes=\"(max-width: 1878px) 100vw, 1878px\" \/><\/p>\n<p>Then, we can go the to the console and explore the code interactively:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646408 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console.png\" alt=\"PyCharm debug console\" width=\"2006\" height=\"1380\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console.png 2006w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-300x206.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-1024x704.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-768x528.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-1536x1057.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-1920x1321.png 1920w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-debug-console-600x413.png 600w\" sizes=\"(max-width: 2006px) 100vw, 2006px\" \/><\/p>\n<h4>Stepping through your code line by line<\/h4>\n<p>Sometimes it is helpful to debug your code line by line. You can do that by setting a breakpoint early in your code and then pressing the &#8220;Step into&#8221; button repeatedly to advance your code one line at a time:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646409 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into.png\" alt=\"PyCharm debug Step Into\" width=\"2006\" height=\"1380\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into.png 2006w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-300x206.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-1024x704.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-768x528.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-1536x1057.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-1920x1321.png 1920w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pycharm-line-step-into-600x413.png 600w\" sizes=\"(max-width: 2006px) 100vw, 2006px\" \/><\/p>\n<h4>Debugging code in the terminal using the built-in pdb module<\/h4>\n<p>Sometimes you want to debug code on a remote machine or server (more on running code remotely in a future episode) and don&#8217;t have access to PyCharm. In this case, the\u00a0<a href=\"https:\/\/docs.python.org\/3\/library\/pdb.html\" rel=\"nofollow\"><code>pdb<\/code><\/a>\u00a0module in Python&#8217;s standard library might be a good option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646410 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1.png\" alt=\"pdb set trace\" width=\"2104\" height=\"1204\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1.png 2104w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-300x172.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-1024x586.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-768x439.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-1536x879.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-2048x1172.png 2048w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-1920x1099.png 1920w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-1-600x343.png 600w\" sizes=\"(max-width: 2104px) 100vw, 2104px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646411 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2.png\" alt=\"pdb set trace 2\" width=\"1560\" height=\"910\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2.png 1560w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2-300x175.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2-1024x597.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2-768x448.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2-1536x896.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/pdb_set-trace-2-600x350.png 600w\" sizes=\"(max-width: 1560px) 100vw, 1560px\" \/><br \/>\nFor more information on using\u00a0<code>pdb<\/code>, we recommend seeing the official documentation at\u00a0<span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/docs.python.org\/3\/library\/pdb.html\" rel=\"nofollow\"><u>https:\/\/docs.python.org\/3\/library\/pdb.html<\/u><\/a><\/span>, which includes a\u00a0<span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/docs.python.org\/3\/library\/pdb.html#debugger-commands\" rel=\"nofollow\"><u>section<\/u><\/a><\/span> describing the different debugger commands.<\/p>\n<p>The most common debugger commands are:<\/p>\n<ul>\n<li><code>l<\/code>\u00a0or\u00a0<code>ll<\/code>\u00a0(longlist) shows the current position in the code<\/li>\n<li><code>h<\/code>\u00a0for help<\/li>\n<li><code>s<\/code>\u00a0to execute the current line<\/li>\n<li><code>q<\/code>\u00a0to quit<\/li>\n<\/ul>\n<h3>Optional: Debugging in JupyterLab<\/h3>\n<p>Note that JupyterLab has a very powerful debugger as well. You can launch it by clicking on the &#8220;bug&#8221; symbol similar to PyCharm:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646412 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug.png\" alt=\"JupyterLab debug\" width=\"2110\" height=\"1596\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug.png 2110w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-300x227.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-1024x775.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-768x581.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-1536x1162.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-2048x1549.png 2048w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-1920x1452.png 1920w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-debug-600x454.png 600w\" sizes=\"(max-width: 2110px) 100vw, 2110px\" \/><\/p>\n<p>The user interface is very similar to PyCharm as well, where you can click next to the line number in order to add a breakpoint. And after setting breakpoints, you can click on &#8220;play&#8221; to start the debugger:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5646413 size-full\" src=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint.png\" alt=\"JupyterLab breakpoint\" width=\"2402\" height=\"1472\" srcset=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint.png 2402w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-300x184.png 300w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-1024x628.png 1024w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-768x471.png 768w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-1536x941.png 1536w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-2048x1255.png 2048w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-1920x1177.png 1920w, https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/jupyterlab-breakpoint-600x368.png 600w\" sizes=\"(max-width: 2402px) 100vw, 2402px\" \/><\/p>\n<p>Stay tuned for future episodes of Lightning Bits! Also, if you have any questions, please don&#8217;t hesitate to reach out on <a style=\"color: #0000ff;\" href=\"https:\/\/pytorch-lightning.slack.com\/archives\/C03GS6MTCCQ\" rel=\"nofollow\"><u>Slack<\/u><\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb. They discuss breakpoints, variable swapping with the console, and many tips and tricks. Watch the video, or continue reading below. Debugging Python Code Learning and using a professional debugging tool is one of the key things<a class=\"excerpt-read-more\" href=\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\" title=\"ReadEP 05: How to Debug Python Code\">&#8230; Read more &raquo;<\/a><\/p>\n","protected":false},"author":16,"featured_media":5646414,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[102],"tags":[88,77,86,79],"glossary":[],"acf":{"hide_from_archive":null,"content_type":null,"code_embed":null,"code_shortcode":null,"custom_styles":null,"sticky":null,"additional_authors":null,"mathjax":null,"default_editor":null,"sections":null,"show_table_of_contents":null,"table_of_contents":null,"tabs":null,"tab_group":null},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>EP 05: How to Debug Python Code - Lightning AI<\/title>\n<meta name=\"description\" content=\"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"EP 05: How to Debug Python Code - Lightning AI\" \/>\n<meta property=\"og:description\" content=\"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Lightning AI\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-13T10:18:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-10T15:13:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"JP Hennessy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@LightningAI\" \/>\n<meta name=\"twitter:site\" content=\"@LightningAI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"JP Hennessy\" \/>\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:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\"},\"author\":{\"name\":\"JP Hennessy\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6\"},\"headline\":\"EP 05: How to Debug Python Code\",\"datePublished\":\"2022-06-13T10:18:20+00:00\",\"dateModified\":\"2022-09-10T15:13:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\"},\"wordCount\":429,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png\",\"keywords\":[\"debug\",\"lightning bits\",\"pycharm\",\"python\"],\"articleSection\":[\"Lightning Bits\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\",\"url\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\",\"name\":\"EP 05: How to Debug Python Code - Lightning AI\",\"isPartOf\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png\",\"datePublished\":\"2022-06-13T10:18:20+00:00\",\"dateModified\":\"2022-09-10T15:13:16+00:00\",\"description\":\"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.\",\"breadcrumb\":{\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage\",\"url\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png\",\"contentUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png\",\"width\":1280,\"height\":720,\"caption\":\"Debugging Python code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/lightning.ai\/pages\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"EP 05: How to Debug Python Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/lightning.ai\/pages\/#website\",\"url\":\"https:\/\/lightning.ai\/pages\/\",\"name\":\"Lightning AI\",\"description\":\"The platform for teams to build AI.\",\"publisher\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/lightning.ai\/pages\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/lightning.ai\/pages\/#organization\",\"name\":\"Lightning AI\",\"url\":\"https:\/\/lightning.ai\/pages\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png\",\"contentUrl\":\"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png\",\"width\":1744,\"height\":856,\"caption\":\"Lightning AI\"},\"image\":{\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/LightningAI\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6\",\"name\":\"JP Hennessy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/lightning.ai\/pages\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g\",\"caption\":\"JP Hennessy\"},\"url\":\"https:\/\/lightning.ai\/pages\/author\/jplightning-ai\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"EP 05: How to Debug Python Code - Lightning AI","description":"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.","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:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/","og_locale":"en_US","og_type":"article","og_title":"EP 05: How to Debug Python Code - Lightning AI","og_description":"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.","og_url":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/","og_site_name":"Lightning AI","article_published_time":"2022-06-13T10:18:20+00:00","article_modified_time":"2022-09-10T15:13:16+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png","type":"image\/png"}],"author":"JP Hennessy","twitter_card":"summary_large_image","twitter_creator":"@LightningAI","twitter_site":"@LightningAI","twitter_misc":{"Written by":"JP Hennessy","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#article","isPartOf":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/"},"author":{"name":"JP Hennessy","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6"},"headline":"EP 05: How to Debug Python Code","datePublished":"2022-06-13T10:18:20+00:00","dateModified":"2022-09-10T15:13:16+00:00","mainEntityOfPage":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/"},"wordCount":429,"commentCount":0,"publisher":{"@id":"https:\/\/lightning.ai\/pages\/#organization"},"image":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage"},"thumbnailUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png","keywords":["debug","lightning bits","pycharm","python"],"articleSection":["Lightning Bits"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/","url":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/","name":"EP 05: How to Debug Python Code - Lightning AI","isPartOf":{"@id":"https:\/\/lightning.ai\/pages\/#website"},"primaryImageOfPage":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage"},"image":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage"},"thumbnailUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png","datePublished":"2022-06-13T10:18:20+00:00","dateModified":"2022-09-10T15:13:16+00:00","description":"In this Lightning Bits episode, William and Sebastian show you how to debug Python code with PyCharm and pdb.","breadcrumb":{"@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#primaryimage","url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png","contentUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2022\/08\/debug-python-code.png","width":1280,"height":720,"caption":"Debugging Python code"},{"@type":"BreadcrumbList","@id":"https:\/\/lightning.ai\/pages\/education\/lightning-bits\/how-to-debug-python-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/lightning.ai\/pages\/"},{"@type":"ListItem","position":2,"name":"EP 05: How to Debug Python Code"}]},{"@type":"WebSite","@id":"https:\/\/lightning.ai\/pages\/#website","url":"https:\/\/lightning.ai\/pages\/","name":"Lightning AI","description":"The platform for teams to build AI.","publisher":{"@id":"https:\/\/lightning.ai\/pages\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/lightning.ai\/pages\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/lightning.ai\/pages\/#organization","name":"Lightning AI","url":"https:\/\/lightning.ai\/pages\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/","url":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png","contentUrl":"https:\/\/lightningaidev.wpengine.com\/wp-content\/uploads\/2023\/02\/image-17.png","width":1744,"height":856,"caption":"Lightning AI"},"image":{"@id":"https:\/\/lightning.ai\/pages\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/LightningAI"]},{"@type":"Person","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/2518f4d5541f8e98016f6289169141a6","name":"JP Hennessy","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/lightning.ai\/pages\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28ade268218ae45f723b0b62499f527a?s=96&d=mm&r=g","caption":"JP Hennessy"},"url":"https:\/\/lightning.ai\/pages\/author\/jplightning-ai\/"}]}},"_links":{"self":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts\/5646402"}],"collection":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/comments?post=5646402"}],"version-history":[{"count":0,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/posts\/5646402\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/media\/5646414"}],"wp:attachment":[{"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/media?parent=5646402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/categories?post=5646402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/tags?post=5646402"},{"taxonomy":"glossary","embeddable":true,"href":"https:\/\/lightning.ai\/pages\/wp-json\/wp\/v2\/glossary?post=5646402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}