0

I'm using Python Colorama on a Linux system to print stdout to the terminal in color. I use the Linux 'tee' command to also capture this output to a file. When the script is done, it emails the captured text file, including the escape sequences, to an email address that I check on Windows. The email has the text file as an attachement, and if I open it with Windows Wordpad I see this:

 [37m [45m [1m**************************************** [40m
 [37m [45m*** Welcome to the QtHttp Test Suite *** [40m
 [37m [45m**************************************** [40m

Here is a screenshot of the terminal in Linux:

enter image description here

If I 'cat' the file in Linux, it shows the color in the terminal.

How can I open the file in Windows so that it honors the escape sequences and shows the text file in color?

Thanks.

PhilBot
  • 748
  • 18
  • 85
  • 173

1 Answers1

1

Just as with Linux, you could cat the file, given an appropriate terminal to interpret the characters. (You do not actually need a terminal - some other programs will do this, e.g., the manpage filter of vi-like-emacs).

The question has been asked before. Here are some links

However, if you are developing on Windows as well, the first place to look would be something like Cygwin, MinGW or MSYS2.

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105