jjangsangy / ExplainToMe

Automatic Web Article Summarizer
Apache License 2.0
412 stars 61 forks source link

ImportError: cannot import name ChainMap #9

Closed swathimithran closed 7 years ago

swathimithran commented 7 years ago

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

jjangsangy commented 7 years ago

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
jjangsangy commented 7 years ago

https://github.com/jjangsangy/ExplainToMe/commit/4758d02baa685440084bb3d3b050c35ecce5123c: The fix has been implemented and it's live.