From acc90c6072d7ece0a4afbab2b9dd3d1ba2857275 Mon Sep 17 00:00:00 2001 From: zariiii9003 <52598363+zariiii9003@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:00:43 +0200 Subject: [PATCH] Stop notifier in examples (#1814) --- examples/print_notifier.py | 6 ++++-- examples/vcan_filtered.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/print_notifier.py b/examples/print_notifier.py index cb4a02799..8d55ca1dc 100755 --- a/examples/print_notifier.py +++ b/examples/print_notifier.py @@ -1,19 +1,21 @@ #!/usr/bin/env python import time + import can def main(): - with can.Bus(receive_own_messages=True) as bus: + with can.Bus(interface="virtual", receive_own_messages=True) as bus: print_listener = can.Printer() - can.Notifier(bus, [print_listener]) + notifier = can.Notifier(bus, [print_listener]) bus.send(can.Message(arbitration_id=1, is_extended_id=True)) bus.send(can.Message(arbitration_id=2, is_extended_id=True)) bus.send(can.Message(arbitration_id=1, is_extended_id=False)) time.sleep(1.0) + notifier.stop() if __name__ == "__main__": diff --git a/examples/vcan_filtered.py b/examples/vcan_filtered.py index f022759fa..9c67390ab 100755 --- a/examples/vcan_filtered.py +++ b/examples/vcan_filtered.py @@ -25,6 +25,7 @@ def main(): bus.send(can.Message(arbitration_id=1, is_extended_id=False)) time.sleep(1.0) + notifier.stop() if __name__ == "__main__":