[issue30075] Printing ANSI Escape Sequences on Windows 10

Tithen Firion report at bugs.python.org
Sat Apr 15 12:21:00 EDT 2017


New submission from Tithen Firion:

Windows 10 supports ANSI Escape Sequences ( http://stackoverflow.com/a/38617204/2428152 https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx ) but Python just prints escape character. Adding `subprocess.call('', shell=True)` before printing solved the issue.

Test code:

    import subprocess
    print('\033[0;31mTEST\033[0m')
    subprocess.call('', shell=True)
    print('\033[0;31mTEST\033[0m')

output in attachment.

Haven't tested it on other Python versions but it probably occurs on them too.

----------
components: IO
files: example.png
messages: 291719
nosy: Tithen Firion
priority: normal
severity: normal
status: open
title: Printing ANSI Escape Sequences on Windows 10
type: behavior
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file46805/example.png

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30075>
_______________________________________


More information about the Python-bugs-list mailing list