Repository: spyder-ide/spyder

Issue:
Spyder crashes on launch trying to load the project config file (.spyderproject)
_From [khe...@gmail.com](https://code.google.com/u/113366480562554195655/) on 2014-06-07T15:55:52Z_

Spyder Version:  2.2.5
Python Version:  2.7.6
Qt Version    :  4.8.6, PyQt4 (API v2) 4.10.4 on Linux
IPython >=0.13  :  1.2.1 (OK)
matplotlib >=1.0:  1.3.1 (OK)
pep8 >=0.6      :  1.4.6 (OK)
pyflakes >=0.5.0:  0.8.1 (OK)
pylint >=0.25   :  1.1.0 (OK)
rope >=0.9.2    :  0.9.2 (OK)
sphinx >=0.6.6  :  1.2.2 (OK)
sympy >=0.7.0   :  0.7.4.1 (OK) 

What steps will reproduce the problem?
1. Set a workspace in the project explorer.
   1. Import an existing directory in the project explorer.
   2. Close spyder
   3. Open spyder

What is the expected output?
Normal spyder execution.

What do you see instead?
Crashes on launch generating the spyder_crash.log file with:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/spyderlib/spyder.py", line 2152, in main
    mainwindow = run_spyder(app, options, args)
  File "/usr/lib/python2.7/dist-packages/spyderlib/spyder.py", line 2047, in run_spyder
    main.setup()
  File "/usr/lib/python2.7/dist-packages/spyderlib/spyder.py", line 793, in setup
    self.projectexplorer = ProjectExplorer(self)
  File "/usr/lib/python2.7/dist-packages/spyderlib/plugins/projectexplorer.py", line 37, in **init**
    self.load_config()
  File "/usr/lib/python2.7/dist-packages/spyderlib/plugins/projectexplorer.py", line 137, in load_config
    self.set_workspace(self.get_option('workspace', None))
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 1296, in set_workspace
    self.treewidget.set_workspace(path)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 696, in set_workspace
    self.workspace.set_root_path(root_path)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 278, in set_root_path
    self.load()
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 307, in load
    setattr(self, attr, data[attr])
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 257, in _set_project_paths
    self.add_project(root_path)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 382, in add_project
    project.set_root_path(root_path)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 86, in set_root_path
    self.load()
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/projectexplorer.py", line 125, in load
    data = cPickle.loads(fdesc.read())
AttributeError: 'dict' object has no attribute 'append' 

Please provide any additional information below

. I got the same issue in this system:
Spyder Version:  2.2.5
Python Version:  2.7.7
Qt Version    :  4.8.5, PyQt4 (API v1) 4.10.4 on Windows
IPython >=0.13  :  None (NOK)
matplotlib >=1.0:  None (NOK)
pep8 >=0.6      :  None (NOK)
pyflakes >=0.5.0:  None (OK)
pylint >=0.25   :  None (NOK)
rope >=0.9.2    :  0.9.4 (OK)
sphinx >=0.6.6  :  None (NOK)

I managed to fix the error by adding the AttributeError exception in the 'except' sentence. I don't know if this is the right way to solve the problem, anyway a patch is attached.

**Attachment:** [spyder_projectexplorer_attributeerror.patch](http://code.google.com/p/spyderlib/issues/detail?id=1845)

_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1845_



Discussion:
_From [bba...@gmail.com](https://code.google.com/u/104157367517601301011/) on 2014-06-11T06:19:59Z_

I'm having the same exact problem.  Your patch works, but only if I open Spyder on the command line. 

Here's my system info:

OS: Mac OS 10.9.3
Hardware: Mac Pro (Late 2013) 
Spyder Version:  2.2.5
Python Version:  2.7.6
Qt Version    :  4.8.6
IPython >=0.13  :  1.2.1 (OK)
matplotlib >=1.0:  1.3.1 (OK)
pep8 >=0.6      :  1.4.6 (OK)
pyflakes >=0.5.0:  0.8.1 (OK)
pylint >=0.25   :  1.1.0 (OK)
rope >=0.9.2    :  0.9.2 (OK)
sphinx >=0.6.6  :  1.2.2 (OK)
sympy >=0.7.0   :  0.7.4.1 (OK)

_From [vasaf...@gmail.com](https://code.google.com/u/111906222258869407944/) on 2014-12-30T11:05:16Z_

Exactly what i've got.

_From [rafi.ku...@gmail.com](https://code.google.com/u/100410492622916352849/) on 2015-01-20T02:10:48Z_

I have the same issue, on two different machines (different hardware, same os)

I have a workspace with several projects, it looks like an error while loading all the .spyderproject files.

The funny part is: only one of these project files looks broken. If I delete that particular file (I attached it if it helps), spyder starts up fine (reporting the error from the last attempt but otherwise starting up fine), but it recreates it and failes again on the next startup.

Note (probably not important): my workspace lives in a folder thats symlinked into /home/user

sys config:

OS: Debian 8.0 Jessie (testing)
Linux laptop 3.16-2-amd64 `#1` SMP Debian 3.16.3-2 (2014-09-20) x86_64 GNU/Linux

Spyder Version:  2.3.2
Python Version:  2.7.8
Qt Version    :  4.8.6, PyQt4 (API v2) 4.11.2 on Linux
pyflakes >=0.5.0:  None (NOK)
pep8 >=0.6      :  None (NOK)
IPython >=0.13  :  2.3.1 (OK)
zmq >=2.1.11    :  14.4.1 (OK)
pygments >=1.6  :  2.0.1 (OK)
pandas >=0.13.1 :  None (NOK)
sphinx >=0.6.6  :  1.3b2 (OK)
psutil >=0.3    :  None (NOK)
rope >=0.9.2    :  0.10.2 (OK)
matplotlib >=1.0:  1.4.2 (OK)
sympy >=0.7.0   :  None (NOK)
pylint >=0.25   :  1.4.0 (OK)

**Attachment:** [.spyderproject.bkup](http://code.google.com/p/spyderlib/issues/detail?id=1845#hc3)

_From [ccordoba12](https://code.google.com/u/ccordoba12/) on 2015-01-30T14:00:58Z_

**Labels:** MS-v2.3.4  

comment to get updates, I'm one of the reporters of this bug (two msgs up)
I'm here for further questions..


Resolving patch:
diff --git a/spyderlib/widgets/projectexplorer.py b/spyderlib/widgets/projectexplorer.py
--- a/spyderlib/widgets/projectexplorer.py
+++ b/spyderlib/widgets/projectexplorer.py
@@ -124,7 +124,7 @@ def load(self):
             # Old format (Spyder 2.0-2.1 for Python 2)
             with open(fname, 'U') as fdesc:
                 data = pickle.loads(fdesc.read())
-        except (pickle.PickleError, TypeError, UnicodeDecodeError):
+        except (pickle.PickleError, TypeError, UnicodeDecodeError, AttributeError):
             try:
                 # New format (Spyder >=2.2 for Python 2 and Python 3)
                 with open(fname, 'rb') as fdesc:


Test patch: