spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.33k stars 1.61k forks source link

copy byte obj to clipboard #11551

Open aazz0099a opened 4 years ago

aazz0099a commented 4 years ago

Description

What steps will reproduce the problem?

  1. create an obj, type = bytes
  2. Copying the byte oject to the clipboard
  3. Faliure of copy

Traceback

  File "C:\Users\Steven\tmp\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionseditor.py", line 1071, in copy
    obj = to_text_string(obj, 'utf8')
  File "C:\Users\Steven\tmp\lib\site-packages\spyder\py3compat.py", line 162, in to_text_string
    return str(obj, encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Versions

Dependencies

atomicwrites >=1.2.0         :  1.3.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
cloudpickle >=0.5.0          :  0.8.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
IPython >=4.0                :  7.4.0 (OK)
jedi =0.14.1                 :  0.14.1 (OK)
nbconvert >=4.0              :  5.4.1 (OK)
numpydoc >=0.6.0             :  0.8.0 (OK)
pexpect >=4.4.0              :  4.8.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
psutil >=0.3                 :  5.6.1 (OK)
pygments >=2.0               :  2.3.1 (OK)
pylint >=0.25                :  2.3.1 (OK)
pyls >=0.31.2;<0.32.0        :  0.31.7 (OK)
zmq >=17                     :  18.0.0 (OK)
qdarkstyle >=2.7             :  2.8 (OK)
qtawesome >=0.5.7            :  0.5.7 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
qtpy >=1.5.0                 :  1.7.0 (OK)
rtree >=0.8.3                :  0.8.3 (OK)
sphinx >=0.6.6               :  1.8.5 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
watchdog                     :  None (OK)
cython >=0.21                :  0.29.6 (OK)
matplotlib >=2.0.0           :  3.0.3 (OK)
numpy >=1.7                  :  1.16.2 (OK)
pandas >=0.13.1              :  0.24.2 (OK)
scipy >=0.17.0               :  1.2.1 (OK)
sympy >=0.7.3                :  1.3 (OK)
goanpeca commented 4 years ago

Just tested with latest 4.x and seems to be working. @dalthviz or @impact27 did you fix this already :-p ?

goanpeca commented 4 years ago

Ok, I tested on Mac only. @dalthviz could you test on windowS?

ccordoba12 commented 4 years ago

create an obj, type = bytes

Please post the code you used to create the object you're trying to copy. We need that to reproduce this error in our side.

dalthviz commented 4 years ago

@goanpeca I tested but I'm unable to trigger an error. Probably as @ccordoba12 asked we need @aazz0099a to give the code to create the object he is trying to copy.

aazz0099a commented 4 years ago

sorry for the late reply guys. i cannot recall really clearly what i was doing at that time but i found my script.

''''''''''''''''''''''' mail = imaplib.IMAP4_SSL('imap.gmail.com') mail.login(ac, pw) mail.select('inbox') email_list = mail.uid('search', None, 'ALL') email_content = mail.uid('fetch', '1', '(RFC822)') raw_message = codecs.decode(email_content[1][0][1], encoding='utf-8', errors='strict')

It seems i was retrieving some data from my mailbox and i guess the bug happened when i was trying to copy the byte message from Spyder. Hope this would help you guys :) @dalthviz @goanpeca @ccordoba12

dalthviz commented 4 years ago

Thanks for the info @aazz0099a !