Home > Enterprise >  ImportError: cannot import name 'Container' from 'collections' - heroku
ImportError: cannot import name 'Container' from 'collections' - heroku

Time:04-07

Code running fine in local, but crash on heroku. what can I do to fix it?

 Traceback (most recent call last)
   File "/app/nao_entre_em_panico.py", line 2, in <module>
     from flask import Flask, jsonify, request
   File "/app/.heroku/python/lib/python3.10/site-packages/flask/__init__.py", line 17, in <module>
     from werkzeug.exceptions import abort
   File "/app/.heroku/python/lib/python3.10/site-packages/werkzeug/__init__.py", line 151, in <module>
     __import__('werkzeug.exceptions')
   File "/app/.heroku/python/lib/python3.10/site-packages/werkzeug/exceptions.py", line 71, in <module>
     from werkzeug.wrappers import Response
   File "/app/.heroku/python/lib/python3.10/site-packages/werkzeug/wrappers.py", line 27, in <module>
     from werkzeug.http import HTTP_STATUS_CODES, \
   File "/app/.heroku/python/lib/python3.10/site-packages/werkzeug/http.py", line 1148, in <module>
     from werkzeug.datastructures import Accept, HeaderSet, ETags, Authorization, \
   File "/app/.heroku/python/lib/python3.10/site-packages/werkzeug/datastructures.py", line 16, in <module>
     from collections import Container, Iterable, MutableSet
 ImportError: cannot import name 'Container' from 'collections' (/app/.heroku/python/lib/python3.10/collections/__init__.py)

CodePudding user response:

Container, Iterable, MutableSet, and other abstract base classes are in collections.abc since Python 3.3.

  • Related