-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fix "module 'collections' has no attribute 'Iterable'" error #152
Comments
THANK YOU!!!!!Lost my whole morning and part of yesterday evening trying to fix this without understanding why was giving problem. My project was working in another venv probably with an older interpreter a lost that project started from scratch and was getting crazy why something that was working before is not working now!BIG THANK YOU again |
Nice! I'm glad you fixed it. Although I really appreciate this library - it's pretty straightforward - , I decided to switch to WP REST API, which is a lot more versatile. |
Actually I use wordpress like forever, I use Python for small things but never join both of them. Chatgpt recommended me this library so I just got to learn there are better ones after 2000 lines of code were done lol. But again dude you saved my day! Own you a coffee! |
No problem, such is the beauty of internet :) |
I wish i saw this earlier. I have a pull request for it ready to go if the author is so inclined: |
Thanks =D |
When trying to retrieve a list of WordPress posts, I got the error
module 'collections' has no attribute 'Iterable'
. This is because in Python 3.10, the version I was using, theIterable
class has been moved to thecollections.abc
module.In order to solve this error, after installing the library with
pip install python-wordpress-xmlrpc
, open the wordpress_xmlrpc folder (it should be in your virtual environment), then open the file base.py.Here, you need to make two replacements:
import collections
withimport collections.abc
elif isinstance(raw_result, collections.Iterable):
withelif isinstance(raw_result, collections.abc.Iterable):
That should fix the error and allow the script to parse the raw result from the WordPress site.
The text was updated successfully, but these errors were encountered: