diff --git a/messaging/__init__.py b/messaging/__init__.py index 60b4934..1d23e9f 100644 --- a/messaging/__init__.py +++ b/messaging/__init__.py @@ -20,7 +20,6 @@ assert wait_for_one_event NO_TRAVERSAL_LIMIT = 2**64-1 AVG_FREQ_HISTORY = 100 -SIMULATION = "SIMULATION" in os.environ # sec_since_boot is faster, but allow to run standalone too try: @@ -179,6 +178,7 @@ class SubMaster: self.ignore_average_freq = [] if ignore_avg_freq is None else ignore_avg_freq self.ignore_alive = [] if ignore_alive is None else ignore_alive + self.simulation = bool(int(os.getenv("SIMULATION", "0"))) for s in services: if addr is not None: @@ -231,11 +231,11 @@ class SubMaster: self.logMonoTime[s] = msg.logMonoTime self.valid[s] = msg.valid - if SIMULATION: + if self.simulation: self.freq_ok[s] = True self.alive[s] = True - if not SIMULATION: + if not self.simulation: for s in self.data: # arbitrary small number to avoid float comparison. If freq is 0, we can skip the check if self.freq[s] > 1e-5: diff --git a/messaging/messaging_pyx.pyx b/messaging/messaging_pyx.pyx index 3e07685..8216aee 100644 --- a/messaging/messaging_pyx.pyx +++ b/messaging/messaging_pyx.pyx @@ -20,8 +20,8 @@ from .messaging cimport Event as cppEvent, SocketEventHandle as cppSocketEventHa class MessagingError(Exception): def __init__(self, endpoint=None): - suffix = "with {endpoint}" if endpoint else "" - message = f"Messaging failure {suffix}: {strerror(errno.errno)}" + suffix = f"with {endpoint.decode('utf-8')}" if endpoint else "" + message = f"Messaging failure {suffix}: {strerror(errno.errno).decode('utf-8')}" super().__init__(message)