Skip to content

Commit f258848

Browse files
committed
use new mkdir_p function to avoid race condition to create config_dir
1 parent e4e81b6 commit f258848

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nipype/utils/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from warnings import warn
1818

1919
from ..external import portalocker
20+
from .filemanip import mkdir_p
2021

2122
# Get home directory in platform-agnostic way
2223
homedir = os.path.expanduser('~')
@@ -62,8 +63,7 @@ class NipypeConfig(object):
6263
def __init__(self, *args, **kwargs):
6364
self._config = ConfigParser.ConfigParser()
6465
config_dir = os.path.expanduser('~/.nipype')
65-
if not os.path.exists(config_dir):
66-
os.makedirs(config_dir)
66+
mkdir_p(config_dir)
6767
old_config_file = os.path.expanduser('~/.nipype.cfg')
6868
new_config_file = os.path.join(config_dir, 'nipype.cfg')
6969
# To be deprecated in two releases

0 commit comments

Comments
 (0)