启动时spyder unicode解码错误

时间:2016-04-30 17:47:09

标签: python-3.x unicode spyder utf8-decode

我在使用作者的许可解析tumblr页面时使用spyder-ide,并且在某些时候所有内容都崩溃了。甚至我的linux系统已经冻结了。好吧,为了切入追逐现在我无法启动spyder,它在我将spyder写入终端后给了我以下错误:

 Traceback (most recent call last):
  File "/home/dk/anaconda3/bin/spyder", line 2, in <module>
    from spyderlib import start_app
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/start_app.py", line 13, in <module>
    from spyderlib.config import CONF
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/config.py", line 736, in <module>
    subfolder=SUBFOLDER, backup=True, raw_mode=True)
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 215, in __init__
    self.load_from_ini()
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 265, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/dk/anaconda3/lib/python3.5/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/dk/anaconda3/lib/python3.5/configparser.py", line 1012, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/dk/anaconda3/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-1: invalid continuation byte

我尝试了解决方案here并收到了以下错误:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/spyder.py", line 107, in <module>
    from spyderlib.utils.qthelpers import qapplication
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/utils/qthelpers.py", line 24, in <module>
    from spyderlib.guiconfig import get_shortcut
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/guiconfig.py", line 22, in <module>
    from spyderlib.config import CONF
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/config.py", line 736, in <module>
    subfolder=SUBFOLDER, backup=True, raw_mode=True)
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 215, in __init__
    self.load_from_ini()
  File "/home/dk/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 265, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/dk/anaconda3/lib/python3.5/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/dk/anaconda3/lib/python3.5/configparser.py", line 1012, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/dk/anaconda3/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-1: invalid continuation byte

我尝试卸载并重新安装anaconda但它似乎无法工作我愿意接受建议,我对python非常陌生,所以我也会对错误的可能原因进行简单的解释。

提前致谢

1 个答案:

答案 0 :(得分:1)

这就是我如何解决这个问题 我打开了这个:self.read(self.filename(), encoding='latin-1')
并改变了这个:Warning: File contains no section headers
对此:spyder --reset
它给了我一个python3.5/configparser.py python3.5/codecs.py ,但无论如何都开始了spyder。之后,我关闭了spyder,打开终端并输入{{1}}然后重新启动spyder,它现在似乎正在工作。
以下是你不应该不惜一切代价解决这个问题:用这些来思考,我从困难的方式吸取了教训:

{{1}}