Skip to content

Commit

Permalink
scripts: json_store: Don't try to create directories with empty names.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlgc committed May 6, 2014
1 parent c1d71bb commit 6ee318c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/utils.py
Expand Up @@ -41,7 +41,9 @@ def json_store(fn, obj, dirs=[''], json_kwargs=json_dump_params):
executed for every root directory in the array."""
for i in dirs:
full_fn = os.path.join(i, fn)
os.makedirs(os.path.dirname(full_fn), exist_ok=True)
dir = os.path.dirname(full_fn)
if dir.strip():
os.makedirs(dir, exist_ok=True)
with open(full_fn, 'w', newline='\n', encoding='utf-8') as file:
json.dump(obj, file, **json_kwargs)
file.write('\n')

0 comments on commit 6ee318c

Please sign in to comment.