This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients daverove, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-04-01.16:15:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This works fine for me in Windows terminal, but I see the behaviour described when using the conventional "Command prompt" window.

Enabling ANSI codes is handled via SetConsoleMode (see here: The following proof of concept script correctly displays coloured text:

    from ctypes import *
    kernel32 = windll.kernel32
    kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
    ansi_red = "\x1b[31m"
    ansi_normal = "\x1b[0m"
    print(ansi_red + "This is red!" + ansi_normal)

Agreed this would be worthwhile setting on stdout by default. The code at seems to be an example of how to do this while still supporting older systems
Date User Action Args
2020-04-01 16:15:17paul.mooresetrecipients: + paul.moore, tim.golden, zach.ware, steve.dower, daverove
2020-04-01 16:15:17paul.mooresetmessageid: <>
2020-04-01 16:15:17paul.moorelinkissue40134 messages
2020-04-01 16:15:17paul.moorecreate