bittensor icon indicating copy to clipboard operation
bittensor copied to clipboard

Don't strip ANSI from stdout (fixes #2365)

Open vaqxai opened this issue 1 year ago • 1 comments

  • Until now ANSI was stripped from stdout if bittensor was not running within a TTY (like in PM2) by colorama when it was intialized
  • This caused colored output to be broken under PM2 (and other process managers which do not give a TTY do bittensor/python
  • Bittensor posseses its own file logger, which makes this behavior unnecessary and unwanted.
  • This patch disables that behavior.

Where ANSI Stripping takes place in colorama: https://github.com/tartley/colorama/blob/136808718af8b9583cb2eed1756ed6972eda4975/colorama/ansitowin32.py#L102

Bittensor call to colorama which indirectly breaks colors in terminal output in PM2: https://github.com/opentensor/bittensor/blob/5edcee44d8ba81898b432ea00d93480fa09d2d18/bittensor/utils/btlogging/format.py#L29

Fix for issue #2365

vaqxai avatar Oct 21 '24 08:10 vaqxai