spyder icon indicating copy to clipboard operation
spyder copied to clipboard

(result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 3597: invalid continuation byte

Open Frodox386 opened this issue 3 years ago • 5 comments

Description

What steps will reproduce the problem?

When I debug my code file it is showed as following:

Traceback

Exception in comms call set_breakpoints:
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/comms/commbase.py", line 340, in _handle_remote_call
    return_value = self._remote_callback(
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/comms/commbase.py", line 353, in _remote_callback
    return self._remote_call_handlers[call_name](
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/console/kernel.py", line 284, in set_spyder_breakpoints
    self._pdb_obj.set_spyder_breakpoints(breakpoints)
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/site-packages/spyder_kernels/customize/spyderpdb.py", line 384, in set_spyder_breakpoints
    self.set_break(self.canonic(fname), linenumber,
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/bdb.py", line 377, in set_break
    line = linecache.getline(filename, lineno)
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/linecache.py", line 16, in getline
    lines = getlines(filename, module_globals)
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/linecache.py", line 137, in updatecache
    lines = fp.readlines()
  File "/Users/pabloalmada/opt/anaconda3/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe1 in position 3597: invalid continuation byte

Versions

  • Spyder version: 4.1.5
  • Python version: 3.8.1
  • Qt version: 5.9.7
  • PyQt5 version: 5.9.2
  • Operating System: Darwin 20.3.0

Dependencies


# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.19.0 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  6.0.7 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.2 (OK)
pylint >=1.0                   :  2.6.0 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.1 (OK)
qtconsole >=4.6.0              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  0.29.21 (OK)
matplotlib >=2.0.0             :  3.3.2 (OK)
numpy >=1.7                    :  1.19.2 (OK)
pandas >=0.13.1                :  1.1.3 (OK)
scipy >=0.17.0                 :  1.5.2 (OK)
sympy >=0.7.3                  :  1.6.2 (OK)

Frodox386 avatar Apr 01 '21 13:04 Frodox386

Hi @Frodox386, thanks for reporting this issue, have you tried to update to the latest Spyder 4 version and see if the error happens?

andfoy avatar Apr 02 '21 16:04 andfoy

I used the following command to upgrade to spyder5, and encountered a similar problem, in the win10 operating system.

conda install spyder=5.0.0
conda update qdarkstyle

image

leavor avatar Apr 06 '21 10:04 leavor

@leavor, this seems to be a different issue, which is related to outdated packages on the defaults channel on Anaconda, we are aware of this issue and we are working to fix it as soon as possible. In the meantime, please install Spyder in a separate environment, using the conda-forge channel

conda install spyder -c conda-forge

andfoy avatar Apr 06 '21 20:04 andfoy

所以这个问题怎么解决?

649924403 avatar Jun 28 '22 16:06 649924403

@649924403, please update to our latest version (5.3.1) to see if the error is fixed there.

Since it's still not available in Anaconda, you have two options:

  1. Use our Windows installer, which you can find here.

  2. Create a new environment with conda-forge packages. For that, please close Spyder, open the Anaconda Prompt and run the following commands there:

     conda create -n spyder-cf -c conda-forge spyder
     conda activate spyder-cf
     spyder
    

ccordoba12 avatar Jun 28 '22 16:06 ccordoba12

Closing due to lack of response.

ccordoba12 avatar Feb 26 '23 15:02 ccordoba12