Python 2.4.x - I cannot install any non-standard modules. *nix environment.
So I've got an output that I have some color in using ansi coloring. Works great. But the output is so long I needed to either pipe to less or use pydoc's page()
Once I do either - the color turns into
ESC[1;36m TEXT TO FOLLOW: ESC[1;37m
I saw over at Cucumber: pipe output without losing color that Adam says that lots of output that is piped lose it's color - but if sent to terminal it's just fine.
Using pydoc's ttypager retains the color output - but doesn't provide a "less" type feature (scrolling back up).
How do I get the best of both worlds? Color and Less type functionality?
Thank you.
Use the -R
flag with less
. This will cause it to output ANSI color escape sequences as they are instead of changing them. It appears to be supported on both my Debian box and my Mac OS X box, which is a good indication that -R
is widely supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With