Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

"TypeError: coercing to Unicode" with colored output #104

Open
smilliken opened this issue Feb 24, 2014 · 2 comments
Open

"TypeError: coercing to Unicode" with colored output #104

smilliken opened this issue Feb 24, 2014 · 2 comments

Comments

@smilliken
Copy link

A minor bug, but was confusing when I stumbled across it. puts(colored.red(1)) works as expected normally, but doesn't degrade correctly when colors aren't supported.

test1.py:

from clint.textui import puts, colored
puts(colored.red(1))

test2.py:

from clint.textui import puts, colored
puts(colored.red('1'))
$ python test1.py
1 (colored)
$ python test1.py | cat
TypeError: coercing to Unicode: need string or buffer, int found
$ python test2.py
1 (colored)
$ python test2.py | cat
1
@aeby
Copy link
Contributor

aeby commented May 9, 2014

What version did you use? If I run your first test I get an AttributeError for the int value. It seems that in the current version only strings are supported.

@zodman
Copy link

zodman commented Oct 14, 2015

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants