Skip to content

Unicode error after v4.35.0 #851

@javiersanp

Description

@javiersanp

ecd2ed6

  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
    • documentation request (i.e. "X is missing from the documentation." If instead I want to ask "how to use X?" I understand StackOverflow#tqdm is more appropriate)
    • new feature request
  • I have visited the source website, and in particular
    read the known issues
  • I have searched through the issue tracker for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
>>> import tqdm, sys
>>> print(tqdm.__version__, sys.version, sys.platform)
('4.34.0', '2.7.15+ (default, Oct  7 2019, 17:39:04) \n[GCC 7.4.0]', 'linux2')
>>> pbar = tqdm.tqdm(total=10, leave=False)
  0%|          | 0/10 [00:00<?, ?it/s]
>>> pbar.set_description(u"áéíóú")
áéíóú:   0%|          | 0/10 [00:00<?, ?it/s]

This code works as expected in version <= 4.34.0 (5b090fd), but raise a UnicodeEncodeError exception in version >= 4.35.0 (ecd2ed6)

>>> import tqdm, sys
>>> print(tqdm.__version__, sys.version, sys.platform)
('4.34.0', '2.7.15+ (default, Oct  7 2019, 17:39:04) \n[GCC 7.4.0]', 'linux2')
>>> pbar = tqdm.tqdm(total=10, leave=False)
  0%|          | 0/10 [00:00<?, ?it/s]
>>> pbar.set_description(u"áéíóú")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tqdm/_tqdm.py", line 1289, in set_description
    self.refresh()
  File "tqdm/_tqdm.py", line 1251, in refresh
    self.display()
  File "tqdm/_tqdm.py", line 1374, in display
    self.sp(self.__repr__() if msg is None else msg)
  File "tqdm/_tqdm.py", line 1020, in __repr__
    return self.format_meter(**self.format_dict)
  File "tqdm/_tqdm.py", line 462, in format_meter
    nobar = bar_format.format(bar=full_bar, **format_dict)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions