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 1313from json import load , dump
1414import os
1515import shutil
16+ import errno
1617from StringIO import StringIO
1718from warnings import warn
1819
5556interval = 1209600
5657""" % (homedir , os .getcwd ())
5758
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+
5870class NipypeConfig (object ):
5971 """Base nipype config class
6072 """
6173
6274 def __init__ (self , * args , ** kwargs ):
6375 self ._config = ConfigParser .ConfigParser ()
6476 config_dir = os .path .expanduser ('~/.nipype' )
65- if not os .path .exists (config_dir ):
66- os .makedirs (config_dir )
77+ mkdir_p (config_dir )
6778 old_config_file = os .path .expanduser ('~/.nipype.cfg' )
6879 new_config_file = os .path .join (config_dir , 'nipype.cfg' )
6980 # To be deprecated in two releases
Original file line number Diff line number Diff line change 1818
1919from ..interfaces .traits_extension import isdefined
2020from .misc import is_container
21+ from .config import mkdir_p
2122
2223from .. import logging , config
2324fmlogger = logging .getLogger ("filemanip" )
You can’t perform that action at this time.
0 commit comments