Console Colors Cause Random Characters to be Typed

Problem description

When I use the console package in Python to log text with color to the terminal, occasionally (minutes after printing), random, color-related characters will be typed, for example ^[]4;2;0/9191/. I can delete these characters, but every once in a while more of them get typed.

Expected behavior

Characters should not be typed when console colors are used.

Actual behavior

Seemingly random characters are typed when console colors are used.

Steps to reproduce

  • Create a Python Repl
  • Install the console package
  • Type the following code:
from console import fg
input("Random characters will be typed here in a few minutes:")


Occurs on both Chrome and Brave


Occurs on both Windows 11 and MacOS Sonoma

Device if mobile

Occurs on both Dell Inspiron 5680 and MacBook Air


Core membership

Could you please get a screenshot or screen recording of the issue happening?


I put my laptop to sleep and it did it when it woke up again.

That sounds like an issue with disconnecting/reconnecting then, more than a time-based thing.


Yeah I’d imagine you’re right.

1 Like