AttributeError: module 'collections' has no attribute 'Sequence'


python 
File "/usr/local/lib/python3.10/site-packages/webhelpers2/html/tags.py", line 442, in _parse_selected_values
    is_seq = isinstance(values, collections.Sequence)
AttributeError: module 'collections' has no attribute 'Sequence'
Ответы
    RemiZOffAlex  Создано: 2021-12-11 13:22:33.446716  Обновлено: 2021-12-11 13:22:33.446732
diff --git a/webhelpers2/html/tags.py b/webhelpers2/html/tags.py
index 93c1d06..41a8c95 100644
--- a/webhelpers2/html/tags.py
+++ b/webhelpers2/html/tags.py
@@ -13,6 +13,7 @@ from __future__ import unicode_literals
 import collections
 import datetime
 import logging
+import sys
 import os
 import re
 
@@ -439,7 +440,10 @@ class Options(_OptionsList):
         if values is None:
             return ("",)
         is_string = isinstance(values, six.string_types)
-        is_seq = isinstance(values, collections.Sequence)
+        if sys.version_info < (3, 10):
+            is_seq = isinstance(values, collections.Sequence)
+        else:
+            is_seq = isinstance(values, collections.abc.Sequence)
         if is_string or not is_seq:
             return (values,)
         else:

Возможно будут интересны и другие вопросы
© RemiZOffAlex