3 ms·
Question: How horribly does the world break if you pipe the output to a file instead of stdout?
by TylerE 5y ago
Question: How horribly does the world break if you pipe the output to a file instead of stdout?
- eyegor 5y agoI would assume the lib authors accounted for this, it's pretty easy to check with sys.stdout.isatty(). If not you could alias it yourself.
- deleted 5y ago[deleted]
- windexh8er 5y agoRich McGugan (author of Rich) talks about a lot of different design aspects of Rich on an episode of Talk Python [0] last October. I've used it in a few projects since then and for what I've been using it for the output is still easily consumable. Rich is a game changer for output in Python and it pairs nicely with CLI libs like Click. McGugan also is putting a lot of effort into Textual [1] which is fantastic for TUI apps. [0] https://talkpython.fm/episodes/show/336/terminal-magic-with-rich-and-textual https://talkpython.fm/episodes/show/336/terminal-magic-with-... [1] https://github.com/Textualize/textual https://github.com/Textualize/textual
- willm 5y ago*Will McGugan :)
- windexh8er 5y agoOh man, fail on my part. Apologies Will! I think now's a great time for me to donate. ¯\_(ツ)_/¯ Edit: Tried to sponsor your linked Ko-fi from what's listed in the rich repo, but the link provided doesn't work and searching your name doesn't pull anything up. Sent you an email to find a better way.
- varenc 5y agoNot at all! Like many CLI tools, it turns off the formatting when it detects you're not outputting to a terminal. Here's where it checks: https://github.com/Textualize/rich/blob/5a457bfbc662ab8701dcb71080d0b9bbdb2b8b72/rich/console.py#L904 https://github.com/Textualize/rich/blob/5a457bfbc662ab8701dc... (and I just tested to confirm it does indeed work)