Solving the ‘Iterable’ Error: My First Contribution to the python-wordpress-xmlrpc Library

The open-source community is built on collaboration, and I am proud to announce that I have made my first contribution in the form of opening an issue on the popular (albeit ancient) python-wordpress-xmlrpc library, created by Max Cutler, on GitHub.

This is a library that allows for easy access to the WordPress XML-RPC API, providing a simple and convenient way to interact with a WordPress site. However, as with any software, issues may arise.

base.py file is located in the wordpress_xmlrpc folder

In my case, I encountered an error when attempting to retrieve a list of WordPress posts. The error message stated that module collections has no attribute 'Iterable'. The thing is, in the version of Python I was using (3.10), the Iterable class had been moved to the collections.abc module.

To solve this issue, you need to make two replacements in the base.py file of the library. The first replacement is at line 1, where import collections needs to be replaced with import collections.abc.

The second replacement is at line 128, where isinstance(raw_result, collections.Iterable) becomes isinstance(raw_result, collections.abc.Iterable).

By making these changes, I was able to successfully parse the raw result from the WordPress site and resolve the error.

However, this issue may affect others, and I wanted to share my solution. I opened an issue on GitHub to inform the maintainers of the library and provide a solution for others.

Leave a Comment