diff --git a/sarracenia/sr.py b/sarracenia/sr.py index 8bfe961fa..9fd686397 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -380,7 +380,7 @@ def save_configs(self, savename): other_config_dir = sarracenia.user_config_dir(savename, self.appauthor) if not os.path.exists(other_config_dir): - os.mkdir(other_config_dir) + pathlib.Path(other_config_dir).mkdir(parents=True, exist_ok=True) for f in ['default.conf', 'admin.conf']: to = other_config_dir + os.sep + f @@ -457,7 +457,6 @@ def _read_state_dir(self): for cfg in self.configs[c]: #print( f" {self.configs[c][cfg]['statehost']=} " ) if 'options' in self.configs[c][cfg] and self.configs[c][cfg]['options'].statehost: - print('statehost') state_dir=self.user_cache_dir + os.sep + self.hostdir + os.sep + c + os.sep + cfg else: state_dir=self.user_cache_dir + os.sep + c + os.sep + cfg @@ -901,14 +900,15 @@ def _resolve(self): } for c in self.components: if not os.path.exists( self.user_cache_dir + os.sep + c ): - os.mkdir(self.user_cache_dir + os.sep + c ) + pathlib.Path(self.user_cache_dir + os.sep + c ).mkdir(parents=True, exist_ok=True) if (c not in self.states) or (c not in self.configs): continue for cfg in self.configs[c]: if cfg not in self.states[c]: print('missing state for %s/%s' % (c,cfg)) - os.mkdir(self.user_cache_dir + os.sep + c + os.sep + cfg) + if not os.path.exists(self.user_cache_dir + os.sep + c + os.sep + cfg): + pathlib.Path(self.user_cache_dir + os.sep + c + os.sep + cfg).mkdir(parents=True, exist_ok=True) # add config as state in .cache under right directory. self.states[c][cfg] = {} self.states[c][cfg]['instance_pids'] = {}