Title: Colored Prompt broken in REPL in Windows in 3.8
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.8
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: MinchinWeb, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-10-21 18:22 by MinchinWeb, last changed 2021-05-13 17:09 by MinchinWeb. This issue is now closed.

File name Uploaded Description Edit
python_colored_prompt.png MinchinWeb, 2019-10-21 18:22 Example of bug locally
Messages (2)
msg355097 - (view) Author: William Minchin (MinchinWeb) Date: 2019-10-21 18:22
I have a Python startup file that colorizes my prompt. This worked on Python 3.7, but breaks on Python 3.8. I'm on Windows using Powershell 6.2.3, but `cmd` does the same.

Maybe related, but the colorization also failed on Python 3.7 if a virtual environment was active.

I am using `colorama` to provide the ANSI color codes.

The startup files:

import sys
import colorama


_GREEN = colorama.Fore.GREEN
_YELLOW = colorama.Fore.YELLOW
_RESET = colorama.Style.RESET_ALL

print("setting prompt, {}, {}, {}.".format(_GREEN, _YELLOW, _RESET))
sys.ps1 = "{}>>> {}".format(_GREEN, _RESET)
sys.ps2 = "{}... {}".format(_YELLOW, _RESET)
msg393588 - (view) Author: William Minchin (MinchinWeb) Date: 2021-05-13 17:09
I can't reproduce this today: Python 3.8.6 (or 3.9.5) with PowerShell 7.1.3 on Windows 10 with Windows Terminal. Maybe it got fixed by a bugfix release of Python 3.8?

I'll close it for now.

Date User Action Args
2021-05-13 17:09:09MinchinWebsetstatus: open -> closed

messages: + msg393588
stage: resolved
2019-10-21 18:22:57MinchinWebcreate