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__":