Error in Python versions >= 3.8 when trying to use collections.Iterable
michaalbert opened this issue · comments
When using this library with a Python version newer than 3.7 it throws this error:
In [9]: posts = client.call(posts.GetPosts())
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-6fd7be5e79cd> in <module>
----> 1 posts = client.call(posts.GetPosts())
/usr/local/lib/python3.10/site-packages/wordpress_xmlrpc/base.py in call(self, method)
44 else:
45 raise
---> 46 return method.process_result(raw_result)
47
48
/usr/local/lib/python3.10/site-packages/wordpress_xmlrpc/base.py in process_result(self, raw_result)
126 if isinstance(raw_result, dict_type):
127 return self.results_class(raw_result)
--> 128 elif isinstance(raw_result, collections.Iterable):
129 return [self.results_class(result) for result in raw_result]
130
AttributeError: module 'collections' has no attribute 'Iterable'
The problem lies in this line and is fixable by changing the import statement to from collections.abc import Iterable
(and of course then also changing collections.Iterable
to just Iterable
in line 129) but I don't know how to make it backwards compatible - maybe using six?
nvm this is already addressed in Pull request #148