Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

When used with Python, it's important to add "PYTHONUNBUFFERED=1" env variable for this to work not just in the terminal but also when piping to files etc.


The environment variable you're thinking of is `PYTHONUNBUFFERED`, not `UNBUFFERED` [0]. If you want a generic solution to this problem, try the `unbuffer` command [1].

For anyone who's interested, I recommend reading Julia Evan's article [2] about this problem and its solutions.

[0]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUN...

[1]: https://manpages.ubuntu.com/manpages/noble/man1/unbuffer.1.h...

[2]: https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-bufferin...


Thanks, I forgot about the PYTHON prefix, fixed it.

On MacOS, can install via homebrew's `expect`: https://apple.stackexchange.com/a/193152/330523

Apparently I knew about this 2.5 years ago as I commented on the accepted answer back then.


The Julia article was a good read. Probably something I run into once a year, but glad to have a better understanding of it.


Julia Evan's article is a great write-up indeed, I'll submit it as a main link.

It's "Julia's article", not "The Julia article".

Update: it is was on here just a month ago actually: https://hackernews.hn/item?id=42275033


It's Julia Evans' article, not Julia Evan's.

I don't know if Julia Evan even has an article.


I was taught that the s is omitted after plural nouns, not after nouns ending in s.

Julia Evans's house, but the Evans' house.


FWIW, I'd accept either one. Some names don't take an extra s by convention, like Jesus, but otherwise it seems in practice that names that feel like plurals don't get it. I'd write "Jess's" but "Jenkins'".

(I consider myself a follower of Lynne Truss's, and have deliberately not considered a grammar reference for this answer, as I'm sure this is within the interested reader's ability and shan't spoil these readers' fun.)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: