From 7bdb6ee556dcac89cef87d116f61bc46dd192849 Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Fri, 27 Feb 2015 15:57:57 +0000 Subject: [PATCH] Fixed cPickle import for Python 3 --- GPy/util/datasets.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index 8aced11a..de157364 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -5,7 +5,6 @@ import copy import numpy as np import GPy import scipy.io -import cPickle as pickle import zipfile import tarfile import datetime @@ -20,6 +19,12 @@ try: except ImportError: ipython_available=False +try: + #In Python 2, cPickle is faster. It does not exist in Python 3 but the underlying code is always used + #if available + import cPickle as pickle +except ImportError: + import pickle import sys, urllib2