From 0245073c550bba95f071893c68120dbe2a5d8219 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 17 Jun 2023 19:29:07 -0400 Subject: [PATCH] serialhdl: Catch os.error on can.interface.Bus() call It seems opening the canbus socket can sometimes throw an os.error (in addition to can.CanError). Catch that error to avoid Klipper reporting an internal error. Signed-off-by: Kevin O'Connor --- klippy/serialhdl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index 02857993..f3c4ed99 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -136,7 +136,7 @@ class SerialReader: can_filters=filters, bustype='socketcan') bus.send(set_id_msg) - except can.CanError as e: + except (can.CanError, os.error) as e: logging.warn("%sUnable to open CAN port: %s", self.warn_prefix, e) self.reactor.pause(self.reactor.monotonic() + 5.)