[Python-modules-team] Bug#1004937: python-opcua: fix collections import under python 3.10+
Andreas Hasenack
andreas at canonical.com
Thu Feb 3 20:29:03 GMT 2022
Package: python-opcua
Version: 0.98.11-1
Severity: normal
Dear Maintainer,
python-opcua is showing this failure under python 3.10:
$ debian/tests/basic-import-py3
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/ubuntu/git/packages/python-opcua/python-opcua/opcua/__init__.py",
line 8, in <module>
from opcua.common.subscription import Subscription
File "/home/ubuntu/git/packages/python-opcua/python-opcua/opcua/common/subscription.py",
line 7, in <module>
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections'
(/usr/lib/python3.10/collections/__init__.py)
Upstream has this fix in 0.98.12:
https://github.com/FreeOpcUa/python-opcua/commit/34d98f992f9f7e494be20f028cdf9a05b3b62540
>From 34d98f992f9f7e494be20f028cdf9a05b3b62540 Mon Sep 17 00:00:00 2001
From: Nick James <20824939+driftregion at users.noreply.github.com>
Date: Fri, 19 Jun 2020 03:56:17 +0800
Subject: [PATCH] remove DeprecationWarning: import Iterable from
collections.abc if python >= 3.6 (#1075)
Co-authored-by: Nick James <nick.james at dorabot.com>
---
opcua/common/subscription.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/opcua/common/subscription.py b/opcua/common/subscription.py
index 19b8d1a8..defbafb0 100644
--- a/opcua/common/subscription.py
+++ b/opcua/common/subscription.py
@@ -4,7 +4,11 @@
import time
import logging
from threading import Lock
-from collections import Iterable
+import sys
+if sys.version_info.major == 3 and sys.version_info.minor >= 6:
+ from collections.abc import Iterable
+else:
+ from collections import Iterable
from opcua import ua
from opcua.common import events
More information about the Python-modules-team
mailing list