'Colorama green and yellow does not work

from colorama import Fore, init, Style

init(convert=True)

print(Fore.GREEN + "Green")
print(Fore.YELLOW + "Yellow")
print(Fore.RED + "Red")
print(Fore.BLACK + "Black")
print(Fore.BLUE + "Blue")
print(Fore.CYAN + "Cyan")

print(Style.RESET_ALL + '')

input()

Output

What can I do to fix it? I am using windows 10



Solution 1:[1]

Since you mentioned that running in CMD works perfectly try using this peice of code, I had a similar issue when I was using colorama. It will force the program to open in CMD which will hopefully fix your error.

if "started_with_prompt" not in sys.argv:
    cmd = 'cmd /C "'+sys.executable+' '+" ".join(sys.argv)+' started_with_prompt"'
    os.system(cmd)
    sys.exit()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WhatsThePoint