Skip to content

Commit

Permalink
Use pathlib to determine parent directory
Browse files Browse the repository at this point in the history
This assists with calling the script to generate a file in the current
directory rather than another directory.

No appreciable effects were observed on output files.

Signed-off-by: Alex Nelson <[email protected]>
  • Loading branch information
ajnelson-nist committed Aug 27, 2024
1 parent 2140697 commit 6fa9740
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/CASE2GeoJSON.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import sys
from os.path import exists, isdir, isfile
from pathlib import Path
from typing import List

from geotypes import GeoRecord
Expand All @@ -22,7 +23,7 @@
sys.exit(1)

# Ensure the output directory exists
output_directory: str = output_filename[: output_filename.rfind("/")]
output_directory: str = str(Path(output_filename).parent.absolute())
if not exists(output_directory) and not isdir(output_directory):
print(f"Directory not found: {output_directory}")
sys.exit(1)
Expand Down

0 comments on commit 6fa9740

Please sign in to comment.