Add debug info for when a bus's headsign isnt found.
This commit is contained in:
+8
-1
@@ -8,6 +8,7 @@ import pandas as pd
|
|||||||
import queue
|
import queue
|
||||||
import refresh_feed
|
import refresh_feed
|
||||||
import requests
|
import requests
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
@@ -242,7 +243,13 @@ class GTFSClient():
|
|||||||
Look up a destination string in Trips from the route and direction
|
Look up a destination string in Trips from the route and direction
|
||||||
"""
|
"""
|
||||||
trips = self.feed.trips
|
trips = self.feed.trips
|
||||||
return trips[(trips["route_id"] == route_id) & (trips["direction_id"] == direction_id)].head(1)["trip_headsign"].item()
|
destination = trips[(trips["route_id"] == route_id) & (trips["direction_id"] == direction_id)].head(1)["trip_headsign"].item()
|
||||||
|
# For some reason destination sometimes isn't a string. Try to find out why
|
||||||
|
if not destination.__class__ == str:
|
||||||
|
sys.stderr.write("Destination not found for route " + str(route_id) + ", direction " + str(direction_id) + "\n")
|
||||||
|
destination = "---- ?????? ----"
|
||||||
|
|
||||||
|
return destination
|
||||||
|
|
||||||
|
|
||||||
def __poll_gtfsr_deltas(self) -> list[map, set]:
|
def __poll_gtfsr_deltas(self) -> list[map, set]:
|
||||||
|
|||||||
@@ -47,11 +47,6 @@ def write_entry(line: int,
|
|||||||
time_color: Color = COLOR_LCD_AMBER, text_color: Color = COLOR_LCD_AMBER):
|
time_color: Color = COLOR_LCD_AMBER, text_color: Color = COLOR_LCD_AMBER):
|
||||||
""" Draws on the screen buffer an entry corresponding to an arrival time. """
|
""" Draws on the screen buffer an entry corresponding to an arrival time. """
|
||||||
|
|
||||||
# For some reason destination sometimes isn't a strint. Try to find out why
|
|
||||||
if not destination.__class__ == str:
|
|
||||||
print("Destination is not a string. Class: " + str(destination.__class__) + ". Value: " + str(destination))
|
|
||||||
destination = "---- ?????? ----"
|
|
||||||
|
|
||||||
# Step 1: Render the fragments
|
# Step 1: Render the fragments
|
||||||
route_img = font.render(route[0:4], True, text_color)
|
route_img = font.render(route[0:4], True, text_color)
|
||||||
destination_img = font.render(destination[0:21], True, text_color)
|
destination_img = font.render(destination[0:21], True, text_color)
|
||||||
|
|||||||
Reference in New Issue
Block a user