package/python-paho-mqtt: fix package for python 3.10
PATCH 1/1 package/python-paho-mqtt: fix package for python 3.10
Fixes the following error on calling mqtt.publish():
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls,
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple
if not isinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
Backported from https://github.com/eclipse/paho.mqtt.python/pull/497/
This was deprecated in python 3.9 and stopped working in python 3.10
--- .../0001-fix-publish-for-python-3-10.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/python-paho-mqtt/0001-fix-publish-for-python-3-10.patch
package/python-paho-mqtt/0001-fix-publish-for-python-3-10.patch new file +37 -0
@@ -0,0 +1,37 @@ +From e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed Mon Sep 17 00:00:00 2001 +From: Brishen Hawkins <[email protected]> +Date: Tue, 9 Jun 2020 00:18:39 -0600 +Subject: [PATCH] Fix for Python 3.9 moving Iterable to collections.abc + +Signed-off-by: Brishen Hawkins <[email protected]> + +Backported from: e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed +Signed-off-by: Marcus Hoffmann <[email protected]> +--- + src/paho/mqtt/publish.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/paho/mqtt/publish.py b/src/paho/mqtt/publish.py +index f9f1986e..dcb34ff1 100644 +--- a/src/paho/mqtt/publish.py ++++ b/src/paho/mqtt/publish.py +@@ -21,6 +21,10 @@ + from __future__ import absolute_import + + import collections ++try: ++ from collections.abc import Iterable ++except ImportError: ++ from collections import Iterable + + from . import client as paho + from .. import mqtt +@@ -124,7 +128,7 @@ def multiple(msgs, hostname="localhost", port=1883, client_id="", keepalive=60, + proxy_args: a dictionary that will be given to the client. + """ + +- if not isinstance(msgs, collections.Iterable): ++ if not isinstance(msgs, Iterable): + raise TypeError('msgs must be an iterable') + + client = paho.Client(client_id=client_id, userdata=collections.deque(msgs),
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedMarcus, All,
On 2022-08-29 19:37 +0200, Marcus Hoffmann spake thusly:
Quoted 8 lines
Fixes the following error on calling
mqtt.publish():File "
/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
multiple([msg], hostname, port,client_id, keepalive, will, auth, tls,
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple
if notisinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
Quoted 5 lines
Backported from https://github.com/eclipse/paho.mqtt.python/pull/497/
This was deprecated in python 3.9 and stopped working in python 3.10
Signed-off-by Marcus Hoffmann <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 55 lines
--- .../0001-fix-publish-for-python-3-10.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 package/python-paho-mqtt/0001-fix-publish-for-python-3-10.patchpackage/python-paho-mqtt/0001-fix-publish-for-python-3-10.patch new file +37
-0@@ -0,0 +1,37 @@ +From e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed Mon Sep 17 00:00:00 2001 +From: Brishen Hawkins <[email protected]> +Date: Tue, 9 Jun 2020 00:18:39 -0600 +Subject: [PATCH] Fix for Python 3.9 moving Iterable to collections.abc + +Signed-off-by: Brishen Hawkins <[email protected]> + +Backported from: e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed +Signed-off-by: Marcus Hoffmann <[email protected]> +--- + src/paho/mqtt/publish.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/paho/mqtt/publish.py b/src/paho/mqtt/publish.py +index f9f1986e..dcb34ff1 100644 +--- a/src/paho/mqtt/publish.py ++++ b/src/paho/mqtt/publish.py +@@ -21,6 +21,10 @@ + from __future__ import absolute_import + + import collections ++try: ++ from collections.abc import Iterable ++except ImportError: ++ from collections import Iterable + + from . import client as paho + from .. import mqtt +@@ -124,7 +128,7 @@ def multiple(msgs, hostname="localhost", port=1883, client_id="", keepalive=60, + proxy_args: a dictionary that will be given to the client. + """ + +- if not isinstance(msgs, collections.Iterable): ++ if not isinstance(msgs, Iterable): + raise TypeError('msgs must be an iterable') + + client = paho.Client(client_id=client_id, userdata=collections.deque(msgs),Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Marcus" == Marcus Hoffmann <[email protected]> writes:
Fixes the following error on calling
mqtt.publish():
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 222, in single
multiple([msg], hostname, port,client_id, keepalive, will, auth, tls,
File "/usr/lib/python3.10/site-packages/paho/mqtt/publish.py", line 126, in multiple
if notisinstance(msgs, collections.Iterable):
AttributeError: module 'collections' has no attribute 'Iterable'
Quoted 5 lines
Backported from https://github.com/eclipse/paho.mqtt.python/pull/497/
This was deprecated in python 3.9 and stopped working in python 3.10
Signed-off-by Marcus Hoffmann <[email protected]>
Committed to 2022.05.x and 2022.02.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot