From 527cda8943aa6e5443c0969bf62ec371d6113bd5 Mon Sep 17 00:00:00 2001 From: ptocca Date: Wed, 22 Jul 2015 16:56:08 +0100 Subject: [PATCH] Fix missing Exception (Windows) This fixes an issue at least on Windows while tring to load data saved earlier in the Variable Explorer At least on Windows, pickle can raise a UnicodeDecodeError when the new format file is opened without mode='wb'. This was not caught and resulted in the failure of the loading of the data. --- spyderlib/utils/iofuncs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyderlib/utils/iofuncs.py b/spyderlib/utils/iofuncs.py index 7e30d3e32fa..9abe1fd89a4 100644 --- a/spyderlib/utils/iofuncs.py +++ b/spyderlib/utils/iofuncs.py @@ -331,7 +331,7 @@ def load_dictionary(filename): # Old format (Spyder 2.0-2.1 for Python 2) with open(pickle_filename, 'U') as fdesc: data = pickle.loads(fdesc.read()) - except (pickle.PickleError, TypeError): + except (pickle.PickleError, TypeError, UnicodeDecodeError): # New format (Spyder >=2.2 for Python 2 and Python 3) with open(pickle_filename, 'rb') as fdesc: data = pickle.loads(fdesc.read())