Preserve colored output from python os.popen()
Question: 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 with the original ANSI encoding.

Example:

    
    
    import os
    output = os.popen("MSBuild VSTests.sln").read()
    print output
    

This prints the output, but without color. Is there any way to preserve this?


Answer: 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:

[set stdout/err text color windows
C++](http://stackoverflow.com/questions/4920661/set-stdout-err-text-color-
windows-c)

