4 ms·
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.
by croemer 2y ago
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.
- Flimm 2y agoThe 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-PYTHONUNBUFFERED https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUN... [1]: https://manpages.ubuntu.com/manpages/noble/man1/unbuffer.1.html https://manpages.ubuntu.com/manpages/noble/man1/unbuffer.1.h... [2]: https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-buffering/ https://jvns.ca/blog/2024/11/29/why-pipes-get-stuck-bufferin...
- 3eb7988a1663 2y agoThe Julia article was a good read. Probably something I run into once a year, but glad to have a better understanding of it.
- croemer 2y agoJulia 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://news.ycombinator.com/item?id=42275033 https://news.ycombinator.com/item?id=42275033
- Y_Y 2y agoIt's Julia Evans' article, not Julia Evan's. I don't know if Julia Evan even has an article.
- teo_zero 2y agoI was taught that the s is omitted after plural nouns, not after nouns ending in s. Julia Evans's house, but the Evans' house.
- Y_Y 2y agoFWIW, 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.)
- croemer 2y agoThanks, I forgot about the PYTHON prefix, fixed it. On MacOS, can install via homebrew's `expect`: https://apple.stackexchange.com/a/193152/330523 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.