Skip to content

pypy + PyCharm + tqdm = UnicodeEncodeError #208

@CrazyPython

Description

@CrazyPython

This only occurs in PyCharm Run/Debug, not terminal. Spotted on PyPy for Python 2

I tested using:

from tqdm import trange
import time

for i in trange(10):
    time.sleep(0.02)

Traceback:

Traceback (most recent call last):
  File "/Users/james/Algorithms Course/scratch.py", line 4, in <module>
    for i in trange(10):
  File "/usr/local/Cellar/pypy/5.3.0/libexec/site-packages/tqdm/_tqdm.py", line 624, in __iter__
    1 / avg_time if avg_time else None, bar_format))
  File "/usr/local/Cellar/pypy/5.3.0/libexec/site-packages/tqdm/_tqdm.py", line 98, in print_status
    fp_write('\r' + s + (' ' * max(last_len[0] - len_s, 0)))
  File "/usr/local/Cellar/pypy/5.3.0/libexec/site-packages/tqdm/_tqdm.py", line 91, in fp_write
    fp.write(_unicode(s))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-10: ordinal not in range(128)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions