Spyder在开始时崩溃:UnicodeDecodeError

时间:2016-06-23 03:32:01

标签: python spyder

在Spyder会话期间,我的Linux冻结了。启动后,我无法启动Spyder;我得到了以下错误:

(trusty)dreamer@localhost:~$ spyder
Traceback (most recent call last):
  File "/home/dreamer/anaconda2/bin/spyder", line 2, in <module>
    from spyderlib import start_app
  File "/home/dreamer/anaconda2/lib/python2.7/site-packages/spyderlib/start_app.py", line 13, in <module>
    from spyderlib.config import CONF
  File "/home/dreamer/anaconda2/lib/python2.7/site-packages/spyderlib/config.py", line 736, in <module>
    subfolder=SUBFOLDER, backup=True, raw_mode=True)
  File "/home/dreamer/anaconda2/lib/python2.7/site-packages/spyderlib/userconfig.py", line 215, in __init__
    self.load_from_ini()
  File "/home/dreamer/anaconda2/lib/python2.7/site-packages/spyderlib/userconfig.py", line 260, in load_from_ini
    self.readfp(configfile)
  File "/home/dreamer/anaconda2/lib/python2.7/ConfigParser.py", line 324, in readfp
    self._read(fp, filename)
  File "/home/dreamer/anaconda2/lib/python2.7/ConfigParser.py", line 479, in _read
    line = fp.readline()
  File "/home/dreamer/anaconda2/lib/python2.7/codecs.py", line 690, in readline
    return self.reader.readline(size)
  File "/home/dreamer/anaconda2/lib/python2.7/codecs.py", line 545, in readline
    data = self.read(readsize, firstline=True)
  File "/home/dreamer/anaconda2/lib/python2.7/codecs.py", line 492, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfe in position 2: invalid start byte
(trusty)dreamer@localhost:~$ 

我找到this solution,这听起来非常像我的问题,但是如果有其他人,我很好奇,是否有人知道为什么会这样。

1 个答案:

答案 0 :(得分:0)

我的猜测是你的spyder配置文件以某种方式被破坏了。这是文件public class AttributeRow { private SimpleStringProperty name; private SimpleBooleanProperty active = new SimpleBooleanProperty(false); public AttributeRow(String name, Boolean active) { this.name= new SimpleStringProperty(name); } public SimpleStringProperty nameProperty() { if (name == null) { name = new SimpleStringProperty(this, "name"); } return name; } public String getAttributeName() { return name.get(); } public void setAttributeName(String fName) { name.set(fName); } public final SimpleBooleanProperty activeProperty() { return this.active; } public final boolean isActive() { return this.activeProperty().get(); } public final void setActive(final boolean active) { this.activeProperty().set(active); } } ,它位于spyder.ini之类的目录中(目录的确切名称取决于您安装的版本)。可能会改变配置文件的编码或以某种方式引入Unicode字节顺序标记。

可能的解决方案:使用编辑器将文件转换回UTF-8;删除配置文件;删除包含配置文件的整个目录。最后两个显然删除了您对配置所做的任何更改。