Urllib3: Deprecation Warning on collections import in _collections.py

Created on 2 Feb 2018  路  5Comments  路  Source: urllib3/urllib3

/pip/_vendor/requests/packages/urllib3/_collections.py:2:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping, MutableMapping

Solution Proposed

Most helpful comment

@haikuginger has this issue been fixed yet? I still get the same errors for Python 3.7 or is there a getaround for this in Py3

All 5 comments

@csabella, is this in the Python 3.7 beta?

@haikuginger Yes, sorry. I created a venv under the 3.7 beta and got the message when using pip.

Okay, let's get this fixed up for 3.8 before we officially add support for 3.7. I recommend the following construct:

try:
    from collections.abc import Mapping, MutableMapping
except ImportError:
    from collections import Mapping, MutableMapping

Another option would be to wait for six to add a moves item for collections.abc and use that, combining it with an upgrade of six to whatever version includes that. However, we don't want to wait too long, because we'll want official support for 3.7 as soon as it releases.

Fixed in #1325.

@haikuginger has this issue been fixed yet? I still get the same errors for Python 3.7 or is there a getaround for this in Py3

Was this page helpful?
0 / 5 - 0 ratings