File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 13
13
from json import load , dump
14
14
import os
15
15
import shutil
16
+ import errno
16
17
from StringIO import StringIO
17
18
from warnings import warn
18
19
55
56
interval = 1209600
56
57
""" % (homedir , os .getcwd ())
57
58
59
+
60
+ def mkdir_p (path ):
61
+ try :
62
+ os .makedirs (path )
63
+ except OSError as exc :
64
+ if exc .errno == errno .EEXIST and os .path .isdir (path ):
65
+ pass
66
+ else :
67
+ raise
68
+
69
+
58
70
class NipypeConfig (object ):
59
71
"""Base nipype config class
60
72
"""
61
73
62
74
def __init__ (self , * args , ** kwargs ):
63
75
self ._config = ConfigParser .ConfigParser ()
64
76
config_dir = os .path .expanduser ('~/.nipype' )
65
- if not os .path .exists (config_dir ):
66
- os .makedirs (config_dir )
77
+ mkdir_p (config_dir )
67
78
old_config_file = os .path .expanduser ('~/.nipype.cfg' )
68
79
new_config_file = os .path .join (config_dir , 'nipype.cfg' )
69
80
# To be deprecated in two releases
Original file line number Diff line number Diff line change 18
18
19
19
from ..interfaces .traits_extension import isdefined
20
20
from .misc import is_container
21
+ from .config import mkdir_p
21
22
22
23
from .. import logging , config
23
24
fmlogger = logging .getLogger ("filemanip" )
You can’t perform that action at this time.
0 commit comments