Skip to content
Snippets Groups Projects
Commit cf67fa43 authored by Sebastin Santy's avatar Sebastin Santy Committed by Olivier Grisel
Browse files

FIX makedirs(..., exists_ok) not available in Python 2 (#9284)

parent 51c8c161
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,8 @@ def fetch_covtype(data_home=None, download_if_missing=True, ...@@ -89,7 +89,8 @@ def fetch_covtype(data_home=None, download_if_missing=True,
available = exists(samples_path) available = exists(samples_path)
if download_if_missing and not available: if download_if_missing and not available:
makedirs(covtype_dir, exist_ok=True) if not exists(covtype_dir):
makedirs(covtype_dir)
logger.warning("Downloading %s" % URL) logger.warning("Downloading %s" % URL)
f = BytesIO(urlopen(URL).read()) f = BytesIO(urlopen(URL).read())
Xy = np.genfromtxt(GzipFile(fileobj=f), delimiter=',') Xy = np.genfromtxt(GzipFile(fileobj=f), delimiter=',')
......
...@@ -114,7 +114,8 @@ def fetch_rcv1(data_home=None, subset='all', download_if_missing=True, ...@@ -114,7 +114,8 @@ def fetch_rcv1(data_home=None, subset='all', download_if_missing=True,
data_home = get_data_home(data_home=data_home) data_home = get_data_home(data_home=data_home)
rcv1_dir = join(data_home, "RCV1") rcv1_dir = join(data_home, "RCV1")
if download_if_missing: if download_if_missing:
makedirs(rcv1_dir, exist_ok=True) if not exists(rcv1_dir):
makedirs(rcv1_dir)
samples_path = _pkl_filepath(rcv1_dir, "samples.pkl") samples_path = _pkl_filepath(rcv1_dir, "samples.pkl")
sample_id_path = _pkl_filepath(rcv1_dir, "sample_id.pkl") sample_id_path = _pkl_filepath(rcv1_dir, "sample_id.pkl")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment