diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index 6cad1eed..f8fa8239 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -206,7 +206,10 @@ def authorize_download(dataset_name=None): def download_data(dataset_name=None): """Check with the user that the are happy with terms and conditions for the data set, then download it.""" - import itertools + try: + from itertools import zip_longest + except ImportError: + from itertools import izip_longest as zip_longest dr = data_resources[dataset_name] if not authorize_download(dataset_name): @@ -220,8 +223,8 @@ def download_data(dataset_name=None): if 'suffices' in dr: zip_urls += (dr['suffices'], ) else: zip_urls += ([],) - for url, files, save_names, suffices in itertools.zip_longest(*zip_urls, fillvalue=[]): - for f, save_name, suffix in itertools.zip_longest(files, save_names, suffices, fillvalue=None): + for url, files, save_names, suffices in zip_longest(*zip_urls, fillvalue=[]): + for f, save_name, suffix in zip_longest(files, save_names, suffices, fillvalue=None): download_url(os.path.join(url,f), dataset_name, save_name, suffix=suffix) return True