8000 FIX makedirs(..., exists_ok) not available in Python 2 (#9284) · CoderPat/scikit-learn@cf67fa4 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf67fa4

Browse files
SebastinSantyogrisel
authored andcommitted
FIX makedirs(..., exists_ok) not available in Python 2 (scikit-learn#9284)
1 parent 51c8c16 commit cf67fa4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sklearn/datasets/covtype.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def fetch_covtype(data_home=None, download_if_missing=True,
8989
available = exists(samples_path)
9090

9191
if download_if_missing and not available:
92-
makedirs(covtype_dir, exist_ok=True)
92+
if not exists(covtype_dir):
93+
makedirs(covtype_dir)
9394
logger.warning("Downloading %s" % URL)
9495
f = BytesIO(urlopen(URL).read())
9596
Xy = np.genfromtxt(GzipFile(fileobj=f), delimiter=',')

sklearn/datasets/rcv1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def fetch_rcv1(data_home=None, subset='all', download_if_missing=True,
114114
data_home = get_data_home(data_home=data_home)
115115
rcv1_dir = join(data_home, "RCV1")
116116
if download_if_missing:
117-
makedirs(rcv1_dir, exist_ok=True)
117+
if not exists(rcv1_dir):
118+
makedirs(rcv1_dir)
118119

119120
samples_path = _pkl_filepath(rcv1_dir, "samples.pkl")
120121
sample_id_path = _pkl_filepath(rcv1_dir, "sample_id.pkl")

0 commit comments

Comments
 (0)
0