From cc638dbe82b8253eb1706be201ce02d3090ace31 Mon Sep 17 00:00:00 2001 From: Max Buchholz Date: Sun, 15 Dec 2024 15:52:56 +0100 Subject: [PATCH] Create the directories required for the log file Instead of failing on missing directories, the script creates the required directories to work --- compare_stops.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compare_stops.py b/compare_stops.py index c3459b2..bcceab4 100644 --- a/compare_stops.py +++ b/compare_stops.py @@ -8,6 +8,7 @@ import spatialite import sqlite3 import traceback +from pathlib import Path from osm_stop_matcher.StatisticsUpdater import StatisticsUpdater from osm_stop_matcher.MatchPicker import MatchPicker @@ -82,6 +83,7 @@ def load_data(db, osmfile, stops_file, gtfs_file, stopsprovider): return metadata def main(osmfile, db_file, stops_file, gtfs_file, stopsprovider, mode, logfile): + Path(logfile).parent.mkdir(parents=True, exist_ok=True) logging.basicConfig(filename=logfile, filemode='w', level=logging.INFO, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S') logger = logging.getLogger('compare_stops')