Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypy + PyCharm + tqdm = UnicodeEncodeError #208

Closed
CrazyPython opened this issue Jul 22, 2016 · 4 comments
Closed

pypy + PyCharm + tqdm = UnicodeEncodeError #208

CrazyPython opened this issue Jul 22, 2016 · 4 comments
Labels
duplicate 🗐 Seen it before invalid ⛔ Not-an-issue or upstream (not-our-issue) p0-bug-critical ☢ Exception rasing

Comments

@CrazyPython
Copy link
Contributor

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)
@casperdcl
Copy link
Member

would be fixable with trange(..., ascii=True). Probably PyCharm reporting
unicode support where it doesn't really exist. Might be able to catch this
in tqdm...

On 22 July 2016 at 20:05, CrazyPython notifications@github.com wrote:

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
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)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#208, or mute the thread
https://github.com/notifications/unsubscribe-auth/AKR9mzO_36tlywiilSQ8LT38BBIpxDX-ks5qYRR3gaJpZM4JTCtA
.

@lrq3000
Copy link
Member

lrq3000 commented Aug 1, 2016

Yes but I'm not sure we should make specific exceptions for all environments that are just wrong in their handling of unicode

Also @CrazyPython I can't remember but are you running Windows? Because if that's the case, the culprit may be a faulty detection of the OS inside an IDE such as PyCharm.

@CrazyPython
Copy link
Contributor Author

CrazyPython commented Aug 1, 2016

@lrq3000 nope, Mac OS X El Captain

Windows has "C:" prepended to path names, btw.

@casperdcl
Copy link
Member

pycharm has other issues: #307 #203

@casperdcl casperdcl added p0-bug-critical ☢ Exception rasing duplicate 🗐 Seen it before invalid ⛔ Not-an-issue or upstream (not-our-issue) labels Nov 12, 2016
This was referenced Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate 🗐 Seen it before invalid ⛔ Not-an-issue or upstream (not-our-issue) p0-bug-critical ☢ Exception rasing
Projects
None yet
Development

No branches or pull requests

3 participants