Skip to content

Commit a545df5

Browse files
committed
minor fix for creating directories
1 parent 4023e48 commit a545df5

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎psyplot/project.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def include(fmto, plotters):
519519
preset[pm][fmto.key] = fmto.value
520520
if fname is not None:
521521
fname = self._resolve_preset_path(fname, False)
522-
os.makedirs(osp.dirname(fname))
522+
os.makedirs(osp.dirname(fname), exist_ok=True)
523523
with open(fname, 'w') as f:
524524
yaml.dump(preset, f)
525525
else:

‎tests/test_project.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def project():
4545
'test.yml')),
4646
("test.yml", "test.yml")])
4747
def test_load_preset(project, preset, path):
48+
os.makedirs(osp.dirname(path), exist_ok=True)
4849
with open(path, 'w') as f:
4950
yaml.dump({"fmt1": "test", "fmt2": "this should be ignored"}, f)
5051
try:

0 commit comments

Comments
 (0)