{"id":562,"date":"2025-09-25T09:24:38","date_gmt":"2025-09-25T08:24:38","guid":{"rendered":"https:\/\/www.project34.net\/?p=562"},"modified":"2025-09-25T09:24:58","modified_gmt":"2025-09-25T08:24:58","slug":"python-print-stops-printing","status":"publish","type":"post","link":"https:\/\/www.project34.net\/index.php\/2025\/09\/25\/python-print-stops-printing\/","title":{"rendered":"Python print stops printing"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;ve created a script that only prints a dot (.) when a process with a tag has been processed. For every process there can be a couple of hunderds of dots printed. I noticed that after a while the dot&#8217;s didn&#8217;t appear anymore. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A bit of googling gave me the answer: <br>End the print statement with &#8220;, flush=True&#8221; and then the print command will output immediately. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So the command<br><code>print('.', end='')<\/code><br>needs to be changed to<br><code>print('.', end='', flush=True)<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">URL: <a href=\"https:\/\/stackoverflow.com\/questions\/25897335\/why-doesnt-print-output-show-up-immediately-in-the-terminal-when-there-is-no-ne\">https:\/\/stackoverflow.com\/questions\/25897335\/why-doesnt-print-output-show-up-immediately-in-the-terminal-when-there-is-no-ne<\/a><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve created a script that only prints a dot (.) when a process with a tag has been processed. For every process there can be a couple of hunderds of dots printed. I noticed that&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[61,60],"class_list":["post-562","post","type-post","status-publish","format-standard","hentry","category-python","tag-print","tag-python"],"_links":{"self":[{"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/posts\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/comments?post=562"}],"version-history":[{"count":2,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/posts\/562\/revisions"}],"predecessor-version":[{"id":565,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/posts\/562\/revisions\/565"}],"wp:attachment":[{"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/media?parent=562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/categories?post=562"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.project34.net\/index.php\/wp-json\/wp\/v2\/tags?post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}