flask-nav icon indicating copy to clipboard operation
flask-nav copied to clipboard

AttributeError on Python 3.10

Open lexdene opened this issue 2 years ago • 3 comments

I am using flask-nav==0.6 on Python 3.10.4 and meet this error:

  File "/usr/local/lib/python3.10/site-packages/flask_nav/__init__.py", line 49, in <module>
    class ElementRegistry(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

lexdene avatar May 30 '22 07:05 lexdene

You need to edit the file flask_nav/__init__.py

and change line 49 to

class ElementRegistry(collections.abc.MutableMapping):

The library is pretty old so I just created my one fork and will start looking for alternatives

pndiku avatar Jul 09 '22 09:07 pndiku

There is a Pull Request to resolve this problem. @mbr Can you handle the PR?

paullilley avatar Sep 14 '22 10:09 paullilley

This is a hack, but it "fixes" the issue in user space:

    import collections
    collections.MutableMapping = collections.abc.MutableMapping
    from flask_nav import Nav
    from flask_nav.elements import *

jeff-dh avatar Mar 31 '23 11:03 jeff-dh