I use the following color class found in this question "Print in terminal with colors?"
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
print(bcolors.FAIL + "some error" + bcolors.ENDC)
When I run this in my python script editor I get the output in the correct red error color:
some error
[Finished in 18.782s]
However when I run from command prompt, or using powershell (my intended console output) I get the this output:
[91msome error[0m
(there are arrows before each "[" but would not show every time I press save)
update:
Here is a capture of the output:
This seems a very attractive approach because I do not have to download or import any new modules and could just include it in a few lines in my script. This was voted to be the best answer but I could not get it working because it seems to interpret \033
as some ASCII for the arrow sign.