numbas / numbas-lti-provider

An LTI tool provider to run Numbas exams
https://docs.numbas.org.uk/lti/en/latest/
Other
11 stars 12 forks source link

[v3.0] collections.Iterable is deprecated in Python 3, and removed in 3.8 #209

Closed peterlcsteele closed 2 years ago

peterlcsteele commented 2 years ago

collections.abc.Iterable is has now been removed in Python 3.8+

The following error is thrown when trying to access the Attempts tab:

daphne_4 | File "/opt/numbas-lti-provider/./numbas_lti/templatetags/querystring.py", line 30, in set_query_values daphne_4 | if isinstance(v, collections.Iterable) and not isinstance(v, six.string_types): daphne_4 | AttributeError: module 'collections' has no attribute 'Iterable'

Temporary workaround: Install Python 3.7 or require Python 3.7 in Dockerfile.

Fix: Use collections.abc.Iterable instead

christianp commented 2 years ago

Fixed in d5108224ac727f2f1fa997e6358c4f971cb35aa6. Thanks for reporting this! I don't know why I never saw this error - I'm using Python 3.9.

christianp commented 2 years ago

This has caused a problem with the set_query_values template tag - strings look iterable, so it thinks they're a list of values.

christianp commented 2 years ago

Now fixed!