Skip to content

Commit

Permalink
Make output parent directory, if needed.
Browse files Browse the repository at this point in the history
Resolves NGEET#17.
  • Loading branch information
samsrabin committed Sep 10, 2024
1 parent 850c7b8 commit af292e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/landusedata/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def main(argv=None):
if os.path.exists(args.output) and not args.overwrite:
raise FileExistsError(f"Output file exists; specify --overwrite to overwrite: {args.output}")

# Create output directory, if needed.
output_directory = os.path.dirname(args.output)
if not os.path.exists(output_directory):
os.makedirs(output_directory)

# Call the default function for the given subcommand
args.func(args)

Expand Down

0 comments on commit af292e7

Please sign in to comment.