Skip to content Skip to sidebar Skip to footer

Preserve Colored Output From Python Os.popen()

I'm using Python to build multiple VS solutions from a given directory using msbuild.exe. I only want specific output, but to save work, the best way to interpret the results is w

Solution 1:

You can't, as far as I know. The color is a property of the console and not of the output text itself. It's not like in Linux where you get escape characters in the text that set the color and reading that out back to console preserves color.

Another side effect of this is that you can't have a separate color for STDOUT and STDERR as shown in this SO question:

Setting stdout/stderr text color in Windows

Post a Comment for "Preserve Colored Output From Python Os.popen()"