From 67bf6681d0a2017f12a24713d289911da1870ad6 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Wed, 19 Aug 2020 10:09:50 +0200 Subject: [PATCH] Can't start server: unexpected keyword argument 'address' #1693 --- glances/autodiscover.py | 21 +++++++++++++++++---- optional-requirements.txt | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/glances/autodiscover.py b/glances/autodiscover.py index 5ec50911..e4dfdaf6 100644 --- a/glances/autodiscover.py +++ b/glances/autodiscover.py @@ -209,10 +209,23 @@ class GlancesAutoDiscoverClient(object): address_family = socket.getaddrinfo(zeroconf_bind_address, args.port)[0][0] # Start the zeroconf service - self.info = ServiceInfo( - zeroconf_type, '{}:{}.{}'.format(hostname, args.port, zeroconf_type), - address=socket.inet_pton(address_family, zeroconf_bind_address), - port=args.port, weight=0, priority=0, properties={}, server=hostname) + try: + self.info = ServiceInfo( + zeroconf_type, '{}:{}.{}'.format( + hostname, args.port, zeroconf_type), + address=socket.inet_pton( + address_family, zeroconf_bind_address), + port=args.port, weight=0, priority=0, properties={}, server=hostname) + except TypeError: + # Manage issue 1663 with breaking change on ServiceInfo method + # address (only one address) is replaced by addresses (list of addresses) + self.info = ServiceInfo( + zeroconf_type, '{}:{}.{}'.format( + hostname, args.port, zeroconf_type), + addresses=[socket.inet_pton( + address_family, zeroconf_bind_address)], + port=args.port, weight=0, priority=0, properties={}, server=hostname) + try: self.zeroconf.register_service(self.info) except socket.error as e: diff --git a/optional-requirements.txt b/optional-requirements.txt index 440482bd..f559328b 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -25,4 +25,4 @@ sparklines statsd wifi zeroconf==0.19.1; python_version < "3.0" -zeroconf; python_version >= "3.0" +zeroconf>=0.28; python_version >= "3.0"