From 1c72242264d7a44837486520dc7e1ef4fd5c7b41 Mon Sep 17 00:00:00 2001 From: Michael Mogenson Date: Mon, 21 Nov 2022 12:31:21 -0500 Subject: [PATCH] Fix for 'Host' object has no attribute 'add_listener' Pyee's add_listener() method was not added until release 9.0.0. Bumble's setup.cfg specifies a minimum pyee version of 8.2.2. Remove the call to add_listener() in l2cap.py. If the add_listener() API is prefered over the on(), another solution would be to bump the pyee version requirement. --- apps/console.py | 5 ++++- bumble/l2cap.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/console.py b/apps/console.py index 19c164f..e0f93b0 100644 --- a/apps/console.py +++ b/apps/console.py @@ -443,7 +443,10 @@ class ConsoleApp: # Discover all services, characteristics and descriptors self.append_to_output('discovering services...') await self.connected_peer.discover_services() - self.append_to_output(f'found {len(self.connected_peer.services)} services, discovering charateristics...') + self.append_to_output( + f'found {len(self.connected_peer.services)} services,' + ' discovering characteristics...' + ) await self.connected_peer.discover_characteristics() self.append_to_output('found characteristics, discovering descriptors...') for service in self.connected_peer.services: diff --git a/bumble/l2cap.py b/bumble/l2cap.py index 78ec0ec..c61a45f 100644 --- a/bumble/l2cap.py +++ b/bumble/l2cap.py @@ -1224,7 +1224,7 @@ class ChannelManager: self._host.remove_listener('disconnection', self.on_disconnection) self._host = host if host is not None: - host.add_listener('disconnection', self.on_disconnection) + host.on('disconnection', self.on_disconnection) def find_channel(self, connection_handle, cid): if connection_channels := self.channels.get(connection_handle):