Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Importing ABC directly from collections was deprecated and will be removed in Python 3.10 #231

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

Closed
tirkarthi opened this issue Apr 21, 2020 · 3 comments · Fixed by #246
Closed

Comments

@tirkarthi
Copy link

Importing ABC directly from collections was deprecated and will be removed in Python 3.10 . Use collections.abc instead.

tests/test_reqstream.py
61:    assert isinstance(r, collections.Iterator)
zerorpc/cli.py
270:    if not isinstance(results, collections.Iterator):
@bombela
Copy link
Member

bombela commented Apr 21, 2020

Can you show an example of the current vs future import name? I don't understand the difference here.

@tirkarthi
Copy link
Author

Below is the common pattern to fix the import issue.

try:
    # Try collections.abc for 3.4+
    from collections.abc import Iterable
except ImportError:
    # Fallback to collections for Python 2
    from collections import Iterable

@bombela
Copy link
Member

bombela commented Apr 21, 2020 via email

chombourger added a commit to chombourger/zerorpc-python that referenced this issue Jan 5, 2022
Kill a depreciation warning by importing "collections.abc" and
fallback to "collections" on failure in order to maintain support
for older versions of Python.

Fixes: 0rpc#231
Signed-off-by: Cedric Hombourger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants