Re: running python script with [command] outputs info only when script exits

Alexandros Drymonitis <[email protected]>
Newsgroups gmane.comp.multimedia.puredata.general
Message-ID <[email protected]>
On 12/10/24 12:31, Roman Haefeli wrote:
> It seems that Python's "print" buffers its output per default. The
> issue you experience seems not specific to [command], but happens also
> when you pipe the output to some other command, like in:
>
> ./counter.py | grep 2
>
> You will see the '2' only appear when the whole script has finished
> running.
>
> You can tell print to immediately flush the current buffer:
>
>       print(i, flush=True)
That did the trick, thanks!

---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/6UW2MAMR6JC5OHXDZH7GHPHX5GUOOKQI/

To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.