Skip to content

Commit

Permalink
Create out-dir if missing (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf-erlich authored Apr 5, 2021
1 parent 923615b commit 1654a5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions singertools/infer_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def infer_schemas(record_inputs, out_dir):

for stream, observations in streams.items():
if out_dir:
if not os.path.exists(out_dir):
os.makedirs(out_dir)

out_file = os.path.join(out_dir, "{}.inferred.json".format(stream))
with open(out_file, 'w') as file:
file.write(json.dumps(to_json_schema(observations), indent=2))
Expand Down

0 comments on commit 1654a5c

Please sign in to comment.