colorama win32 calls have no effect on a win64 system

133 Views Asked by At

on windows10 I have never been able to get colorama to work. I am now on Python38 and colorama-0.4.4 I have checked that the ansitowin32 module is executing call_win32 but no color results. Is this because my windows is based on win64? Here is my code and output: import colorama # Successfully installed colorama-0.4.4

from colorama import Fore, Style
colorama.init(convert=True)   # to make windows calls for the escape sequences

print('default color')
print(f'{Fore.GREEN} in green {Style.RESET_ALL}.')


default color
 in green
1

There are 1 best solutions below

5
Novin.Nouri On

The problem is your line 2

It will not run without import init

from colorama import Fore, Style, init
init(convert=True)

print('default color')
print(f'{Fore.GREEN} in green {Style.RESET_ALL}.')

or this with import colorama:

import colorama
colorama.init(convert=True)   

print('default color')
print(f'{colorama.Fore.GREEN} in green {colorama.Style.RESET_ALL}.')