Skip to content
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

Problem with python > 3.8 and MutableMapping #9

Open
Te-k opened this issue Apr 4, 2022 · 1 comment
Open

Problem with python > 3.8 and MutableMapping #9

Te-k opened this issue Apr 4, 2022 · 1 comment

Comments

@Te-k
Copy link

Te-k commented Apr 4, 2022

On my computer with python 3.10.4 with dnsdb 0.2.5

> from dnsdb import Dnsdb
File ~/env/default3/lib/python3.10/site-packages/diskcache/persistent.py:8, in <module>
      5 import operator as op
      6 import sys
----> 8 from collections import MutableMapping, OrderedDict, Sequence
      9 from collections import KeysView, ValuesView, ItemsView
     10 from itertools import islice

ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

On python > 3.8, you need to import MutableMapping fromcollections.abc (ref). This code should solve the issue :

import sys

if sys.version_info[:2] >= (3, 8):
    from collections.abc import MutableMapping
else:
    from collections import MutableMapping
@Te-k
Copy link
Author

Te-k commented Apr 4, 2022

My bad, I realize it is actually an issue with diskcache, dnsdb 0.2.5 requires diskcache<4.0,>=3.1, but you have diskcache 5.4.0 which is incompatible.. So upgrading diskcache should solve the issue (but may create other problems with changes in the API)

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

No branches or pull requests

1 participant