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

Error when trying to view the contents of a binary string in the Variable Explorer for Python 2 #3673

Closed
ccordoba12 opened this issue Nov 10, 2016 · 1 comment

Comments

@ccordoba12
Copy link
Member

If you evaluate this code in Python 2

import string
dig_its = string.digits;
translate_digits = string.maketrans(dig_its,len(dig_its)*' ')

and then do a double-click on the variable called translate_digits in the Variable Explorer, you get this error in the internal console

Traceback (most recent call last):
  File "/home/carlos/Projects/spyder/github-repo/spyder/widgets/variableexplorer/collectionseditor.py", line 483, in createEditor
    editor = TextEditor(value, key)
  File "/home/carlos/Projects/spyder/github-repo/spyder/widgets/variableexplorer/texteditor.py", line 44, in __init__
    text = to_text_string(text, 'utf8')
  File "/home/carlos/Projects/spyder/github-repo/spyder/py3compat.py", line 137, in to_text_string
    return unicode(obj, encoding)
  File "/home/carlos/.virtualenvs/test-ipy-stable/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 128: invalid start byte

i think the solution is if we fail to initialize TextEditor, then we shouldn't show it.

@mariacamilaremolinagutierrez, DataFrameEditor has a method called setup_and_check, for you to look at. TextEditor should have a similar method to use it as DataFrameEditor.setup_and_check is also used.

@ccordoba12
Copy link
Member Author

@mariacamilaremolinagutierrez, this is your last issue for 3.1, so please try to finish it this week.

Then you can start to work on your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants