jjangsangy/ExplainToMe

ImportError: cannot import name ChainMap

Closed this issue · 2 comments

Hi Sir,

I tried installing the project according to the readme steps, But i am getting ImportError when I run the command "python manage.py runserver", I tried using docker installation but I am getting the same ImportError, the stack trace is as given below:

ExplainToMe$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 6, in
app = create_app()
File "/home/swathimithran/ExplainToMe/ExplainToMe/app.py", line 46, in create_app
f(app)
File "/home/swathimithran/ExplainToMe/ExplainToMe/app.py", line 27, in register_blueprints
from . views import root, api
File "/home/swathimithran/ExplainToMe/ExplainToMe/views/init.py", line 2, in
from . root import root
File "/home/swathimithran/ExplainToMe/ExplainToMe/views/root.py", line 4, in
from collections import ChainMap
ImportError: cannot import name ChainMap

Thanks for reporting this, I've recently ported the code to Python 3 by default and Chainmap was moved out of stdlib in Python 3. I'll patch this issue, but if you want to run this on Python 2, you need to install Chainmap using.

pip install chainmap

And wrap the code that imports chainmap in a try..except

try:
     from collections import ChainMap
except ImportError:
     from chainmap import ChainMap

4758d02: The fix has been implemented and it's live.