-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix bug in pd.read_clipboard on windows with PY3 (GH4561); not decoding properly #4571
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
Conversation
try: | ||
encoding = kwargs.get('encoding') | ||
if encoding is None: | ||
encoding = 'UTF-8' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this maybe be get_option('display.encoding')
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could even do
encoding = kwargs.get('encoding', get_option('display.encoding'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
this is a windows encoding, could use on side note: in pandas/compat.py
shouldn't this be:
|
why? strings are immutable so even if it's appended to in the function it won't be seen in the caller |
similar to if you increment an def f(x):
x += 1
y = 1
f(y)
print(y) # prints 1 |
also i think it's |
@jreback how about: def bytes_to_str(b, encoding='utf-8'):
return b.decode(encoding or 'utf-8') For the other one, you can just wrap in an or instead - clearer and doesn't execute get_option if not needed encoding = kwargs.get('encoding') or get_option('display.encoding') |
What's with all of you green icon folk? 😄 |
they must have changed the default, I don't have a pic up |
https://travis-ci.org/jreback/pandas/jobs/10216546 I guess pyperclip acts differently on windows and linux under py3....... |
it's annoying that all string types in python2 have |
you could monkey-patch strings at runtime to make it a noop! but pretty I guess the error means you are not doing something right |
BUG: Fix bug in pd.read_clipboard on windows with PY3 (GH4561); not decoding properly
closes #4561