Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8d3b424

Browse filesBrowse files
authored
FIX race condition in get_data_home causing FileExistsError (#19560)
1 parent c00c4bd commit 8d3b424
Copy full SHA for 8d3b424

File tree

1 file changed

+2
-3
lines changed
Filter options

1 file changed

+2
-3
lines changed

‎sklearn/datasets/_base.py

Copy file name to clipboardExpand all lines: sklearn/datasets/_base.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import shutil
1313
from collections import namedtuple
1414
from os import environ, listdir, makedirs
15-
from os.path import dirname, exists, expanduser, isdir, join, splitext
15+
from os.path import dirname, expanduser, isdir, join, splitext
1616

1717
from ..utils import Bunch
1818
from ..utils import check_random_state
@@ -52,8 +52,7 @@ def get_data_home(data_home=None) -> str:
5252
data_home = environ.get('SCIKIT_LEARN_DATA',
5353
join('~', 'scikit_learn_data'))
5454
data_home = expanduser(data_home)
55-
if not exists(data_home):
56-
makedirs(data_home)
55+
makedirs(data_home, exist_ok=True)
5756
return data_home
5857

5958

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.