Repository: spyder-ide/spyder

Issue:
Spyder fails to launch because of errors in spyder.ini
@ccordoba12 
## Description of your problem

**What steps will reproduce the problem?**

My spyder was working fine, I did an update on my linux and now it does not run at all. I installed it again and it does not run yet.

**What is the expected output? What do you see instead?**
I get this traceback:

Traceback (most recent call last):
  File "/home/hamid/anaconda3/bin/spyder", line 2, in <module>
    from spyderlib import start_app
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/start_app.py", line 13, in <module>
    from spyderlib.config import CONF
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/config.py", line 736, in <module>
    subfolder=SUBFOLDER, backup=True, raw_mode=True)
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 215, in **init**
    self.load_from_ini()
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 265, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/hamid/anaconda3/lib/python3.5/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/hamid/anaconda3/lib/python3.5/configparser.py", line 1012, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/hamid/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 byte 0xeb in position 0: invalid continuation byte
## Versions and main components
- Spyder Version: 2.3.8
- Python Version: 3.5
- Operating system:Linux 15.10



Discussion:
Try `spyder --reset`. You'll lose your spyder config but it should fix your problem.

Gives me same error:

hamid@hamid-Lenovo-IdeaPad-U530-Touch:~$ spyder --reset
Traceback (most recent call last):
  File "/home/hamid/anaconda3/bin/spyder", line 2, in <module>
    from spyderlib import start_app
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/start_app.py", line 13, in <module>
    from spyderlib.config import CONF
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/config.py", line 736, in <module>
    subfolder=SUBFOLDER, backup=True, raw_mode=True)
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 215, in **init**
    self.load_from_ini()
  File "/home/hamid/anaconda3/lib/python3.5/site-packages/spyderlib/userconfig.py", line 265, in load_from_ini
    self.read(self.filename(), encoding='utf-8')
  File "/home/hamid/anaconda3/lib/python3.5/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/home/hamid/anaconda3/lib/python3.5/configparser.py", line 1012, in _read
    for lineno, line in enumerate(fp, start=1):
  File "/home/hamid/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 byte 0xf7 in position 0: invalid start byte

Actually, I installed anaconda again and still getting the same error! iPython works though!

Then please do

```
rm -Rf ~/.spyder2-py3
```

and try again

@ccordoba12  I have a similar problem. When I run spyder in command line, I got this message. 

> Traceback
> 
>  (most recent call last):
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 2998, in main
>     mainwindow = run_spyder(app, options, args)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 2902, in run_spyder
>     main.setup()
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 1153, in setup
>     self.setup_layout(default=False)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 1414, in setup_layout
>     self.setup_default_layouts('default', settings)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 1593, in setup_default_layouts
>     widget.toggle_view(True)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 677, in toggle_view
>     self.create_new_client(give_focus=False)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 886, in create_new_client
>     self.connect_client_to_kernel(client)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 903, in connect_client_to_kernel
>     km, kc = self.create_kernel_manager_and_kernel_client(connection_file)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 1276, in create_kernel_manager_and_kernel_client
>     kernel_manager._kernel_spec = self.create_kernel_spec()
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/plugins/ipythonconsole.py", line 1256, in create_kernel_spec
>     uv = to_text_string(v)
>   File "/home/park/anaconda2/lib/python2.7/site-packages/spyder/py3compat.py", line 136, in to_text_string
>     return unicode(obj)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 73: ordinal not in range(128)

My Error is UnicodeDecodeError related to 'ascii'. I tried your suggestion. 
But I can not fix it.
Could you tell me how to fix it, if you have another solution?

@eunsoo, your problem is different. Please open a new issue about it and include the output of running

```
printenv
```

in a terminal (i.e. in bash or zsh :-)

@ccordoba12 
This is my result from printenv.

> XDG_VTNR=7
> LC_PAPER=en_US.UTF-8
> ORBIT_SOCKETDIR=/tmp/orbit-park
> SSH_AGENT_PID=2030
> LC_ADDRESS=en_US.UTF-8
> XDG_SESSION_ID=c2
> XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/park
> SELINUX_INIT=YES
> LC_MONETARY=en_US.UTF-8
> TERMINATOR_UUID=urn:uuid:fee25cf7-6076-4c4f-b086-5f71f722f364
> IBUS_DISABLE_SNOOPER=1
> CLUTTER_IM_MODULE=xim
> GPG_AGENT_INFO=/run/user/1000/keyring-OBxHK0/gpg:0:1
> TERM=xterm
> SHELL=/bin/bash
> SSH_AGENT_LAUNCHER=upstart
> WINDOWID=39845892
> LC_NUMERIC=en_US.UTF-8
> UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1973
> GNOME_KEYRING_CONTROL=/run/user/1000/keyring-OBxHK0
> GTK_MODULES=overlay-scrollbar:unity-gtk-module
> LC_ALL=en_US.UTF-8
> CUDA_HOME=/usr/local/cuda
> USER=park
> LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/usr/local/cuda/lib64/::/home/park/anaconda2/lib:/home/park/OpenBLAS
> LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:_.tar=01;31:_.tgz=01;31:_.arj=01;31:_.taz=01;31:_.lzh=01;31:_.lzma=01;31:_.tlz=01;31:_.txz=01;31:_.zip=01;31:_.z=01;31:_.Z=01;31:_.dz=01;31:_.gz=01;31:_.lz=01;31:_.xz=01;31:_.bz2=01;31:_.bz=01;31:_.tbz=01;31:_.tbz2=01;31:_.tz=01;31:_.deb=01;31:_.rpm=01;31:_.jar=01;31:_.war=01;31:_.ear=01;31:_.sar=01;31:_.rar=01;31:_.ace=01;31:_.zoo=01;31:_.cpio=01;31:_.7z=01;31:_.rz=01;31:_.jpg=01;35:_.jpeg=01;35:_.gif=01;35:_.bmp=01;35:_.pbm=01;35:_.pgm=01;35:_.ppm=01;35:_.tga=01;35:_.xbm=01;35:_.xpm=01;35:_.tif=01;35:_.tiff=01;35:_.png=01;35:_.svg=01;35:_.svgz=01;35:_.mng=01;35:_.pcx=01;35:_.mov=01;35:_.mpg=01;35:_.mpeg=01;35:_.m2v=01;35:_.mkv=01;35:_.webm=01;35:_.ogm=01;35:_.mp4=01;35:_.m4v=01;35:_.mp4v=01;35:_.vob=01;35:_.qt=01;35:_.nuv=01;35:_.wmv=01;35:_.asf=01;35:_.rm=01;35:_.rmvb=01;35:_.flc=01;35:_.avi=01;35:_.fli=01;35:_.flv=01;35:_.gl=01;35:_.dl=01;35:_.xcf=01;35:_.xwd=01;35:_.yuv=01;35:_.cgm=01;35:_.emf=01;35:_.axv=01;35:_.anx=01;35:_.ogv=01;35:_.ogx=01;35:_.aac=00;36:_.au=00;36:_.flac=00;36:_.mid=00;36:_.midi=00;36:_.mka=00;36:_.mp3=00;36:_.mpc=00;36:_.ogg=00;36:_.ra=00;36:_.wav=00;36:_.axa=00;36:_.oga=00;36:_.spx=00;36:_.xspf=00;36:
> LC_TELEPHONE=en_US.UTF-8
> XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
> XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> SSH_AUTH_SOCK=/run/user/1000/keyring-OBxHK0/ssh
> DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
> XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
> DESKTOP_SESSION=ubuntu
> PATH=/home/park/anaconda2/bin:/usr/local/cuda/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> QT_IM_MODULE=ibus
> QT_QPA_PLATFORMTHEME=appmenu-qt5
> LC_IDENTIFICATION=en_US.UTF-8
> PWD=/home/park/Dropbox/100.Projects/distillation_privileged_information
> JOB=gnome-session
> XMODIFIERS=@im=ibus
> GNOME_KEYRING_PID=1969
> LANG=en_US.UTF-8
> GDM_LANG=en_US
> MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
> LC_MEASUREMENT=en_US.UTF-8
> UBUNTU_MENUPROXY=1
> COMPIZ_CONFIG_PROFILE=ubuntu
> IM_CONFIG_PHASE=1
> PAPERSIZE=letter
> GDMSESSION=ubuntu
> SESSIONTYPE=gnome-session
> SHLVL=2
> HOME=/home/park
> XDG_SEAT=seat0
> LANGUAGE=en_US:en
> GNOME_DESKTOP_SESSION_ID=this-is-deprecated
> UPSTART_INSTANCE=
> PYTHONPATH=/home/park/keras:/home/park/SSD/caffe/python:/home/park/SSD/caffe/python: 
> UPSTART_EVENTS=started starting
> LOGNAME=park
> DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-ycCDUgRMAk
> XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
> QT4_IM_MODULE=xim
> LESSOPEN=| /usr/bin/lesspipe %s
> CITYSCAPES_DATASET=/home/park/mnt/DBs/CityScape
> INSTANCE=Unity
> TEXTDOMAIN=im-config
> UPSTART_JOB=unity-settings-daemon
> XDG_RUNTIME_DIR=/run/user/1000
> DISPLAY=:0
> CAFFE_ROOT=/home/park/SSD/caffe
> XDG_CURRENT_DESKTOP=Unity
> GTK_IM_MODULE=ibus
> LESSCLOSE=/usr/bin/lesspipe %s %s
> LC_TIME=en_US.UTF-8
> TEXTDOMAINDIR=/usr/share/locale/
> LC_NAME=en_US.UTF-8
> XAUTHORITY=/home/park/.Xauthority
> COLORTERM=gnome-terminal
> _=/usr/bin/printenv


Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -591,10 +591,14 @@
 CONF_VERSION = '29.0.0'
 
 # Main configuration instance
-CONF = UserConfig('spyder', defaults=DEFAULTS, load=(not TEST),
-                  version=CONF_VERSION, subfolder=SUBFOLDER, backup=True,
-                  raw_mode=True)
-
+try:
+    CONF = UserConfig('spyder', defaults=DEFAULTS, load=(not TEST),
+                      version=CONF_VERSION, subfolder=SUBFOLDER, backup=True,
+                      raw_mode=True)
+except:
+    CONF = UserConfig('spyder', defaults=DEFAULTS, load=False,
+                      version=CONF_VERSION, subfolder=SUBFOLDER, backup=True,
+                      raw_mode=True)
 
 # Removing old .spyder.ini location:
 old_location = osp.join(get_home_dir(), '.spyder.ini')


Test patch: