From b0cba1cd5758c70adec193bf50b2822176c5d8ea Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Mon, 11 Nov 2024 10:22:26 +0000 Subject: [PATCH] Fix cases where '3ALPHA' not found for given TIPLOC --- src/train_detail.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/train_detail.py b/src/train_detail.py index 6a2599e..344ebed 100644 --- a/src/train_detail.py +++ b/src/train_detail.py @@ -60,8 +60,10 @@ def create_crs_list_from_stops(stops): for stop in stops: if not stop['isPublic']: continue - - loc_ref = ob_client.get_loc_ref_codes_by_tiploc(stop['tiploc']) - - crs_list.append(loc_ref[0]['3ALPHA']) + try: + loc_ref = ob_client.get_loc_ref_codes_by_tiploc(stop['tiploc']) + crs_list.append(loc_ref[0]['3ALPHA']) + except Exception as e: + print("Unable to load 3ALPHA for: ", stop['tiploc']) + crs_list.append("---") return crs_list \ No newline at end of file