Run.py error; module 'collections' has no attribute 'Iterable'

Hi,

I use an virtual environment and finally install requirments.txt, but it has the following errors when execute “python run.py”

(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>python run.py
Traceback (most recent call last):
  File "C:\Program Files\MongoDB\M220P\mflix-python\run.py", line 1, in <module>
    from mflix.factory import create_app
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix\factory.py", line 12, in <module>
    from mflix.api.movies import movies_api_v1
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix\api\movies.py", line 10, in <module>
    from mflix.api.user import User
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix\api\user.py", line 48, in <module>
    CORS(user_api_v1)
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\extension.py", line 129, in __init__
    self.init_app(app, **kwargs)
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\extension.py", line 134, in init_app
    options = get_cors_options(app, self._options, kwargs)
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\core.py", line 295, in get_cors_options
    return serialize_options(options)
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\core.py", line 373, in serialize_options
    serialize_option(options, 'methods', upper=True)
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\core.py", line 330, in serialize_option
    value = flexible_str(options_dict[key])
  File "C:\Program Files\MongoDB\M220P\mflix-python\mflix_venv\lib\site-packages\flask_cors\core.py", line 322, in flexible_str
    and isinstance(obj, collections.Iterable)):
**AttributeError: module 'collections' has no attribute 'Iterable'**

I did have problem for the requirements.txt and modified it by the following items.
cffi==1.15.0
pyzmq==22.3.0

requirements.txt (1.2 KB)

(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>pip install -r requirements.txt
Requirement already satisfied: appnope==0.1.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 1)) (0.1.0)
Requirement already satisfied: attrs==19.1.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 2)) (19.1.0)
Requirement already satisfied: backcall==0.1.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 3)) (0.1.0)
Requirement already satisfied: bcrypt==3.1.7 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 4)) (3.1.7)
Requirement already satisfied: bleach==3.1.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 5)) (3.1.0)
Requirement already satisfied: cffi==1.15.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 6)) (1.15.0)
Requirement already satisfied: Click==7.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 7)) (7.0)
Requirement already satisfied: decorator==4.4.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 8)) (4.4.0)
Requirement already satisfied: defusedxml==0.6.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 9)) (0.6.0)
Requirement already satisfied: dnspython==1.15.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 10)) (1.15.0)
Requirement already satisfied: entrypoints==0.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 11)) (0.3)
Requirement already satisfied: Faker==0.8.13 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 12)) (0.8.13)
Requirement already satisfied: flake8==3.7.8 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 13)) (3.7.8)
Requirement already satisfied: Flask==0.12.4 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 14)) (0.12.4)
Requirement already satisfied: Flask-Bcrypt==0.7.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 15)) (0.7.1)
Requirement already satisfied: Flask-Cors==3.0.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 16)) (3.0.3)
Requirement already satisfied: Flask-JWT-Extended==3.7.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 17)) (3.7.0)
Requirement already satisfied: Flask-Login==0.4.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 18)) (0.4.0)
Requirement already satisfied: importlib-metadata==0.23 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 19)) (0.23)
Requirement already satisfied: ipykernel==5.1.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 20)) (5.1.3)
Requirement already satisfied: ipython==7.8.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 21)) (7.8.0)
Requirement already satisfied: ipython-genutils==0.2.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 22)) (0.2.0)
Requirement already satisfied: ipywidgets==7.5.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 23)) (7.5.1)
Requirement already satisfied: itsdangerous==1.1.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 24)) (1.1.0)
Requirement already satisfied: jedi==0.15.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 25)) (0.15.1)
Requirement already satisfied: Jinja2==2.10.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 26)) (2.10.3)
Requirement already satisfied: jsonschema==3.1.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 27)) (3.1.1)
Requirement already satisfied: jupyter==1.0.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 28)) (1.0.0)
Requirement already satisfied: jupyter-client==5.3.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 29)) (5.3.1)
Requirement already satisfied: jupyter-console==6.0.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 30)) (6.0.0)
Requirement already satisfied: jupyter-core==4.4.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 31)) (4.4.0)
Requirement already satisfied: MarkupSafe==1.1.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 32)) (1.1.1)
Requirement already satisfied: mccabe==0.6.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 33)) (0.6.1)
Requirement already satisfied: mistune==0.8.4 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 34)) (0.8.4)
Requirement already satisfied: more-itertools==7.2.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 35)) (7.2.0)
Requirement already satisfied: nbconvert==5.6.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 36)) (5.6.0)
Requirement already satisfied: nbformat==4.4.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 37)) (4.4.0)
Requirement already satisfied: notebook==6.0.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 38)) (6.0.1)
Requirement already satisfied: pandocfilters==1.4.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 39)) (1.4.2)
Requirement already satisfied: parso==0.5.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 40)) (0.5.1)
Requirement already satisfied: pexpect==4.7.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 41)) (4.7.0)
Requirement already satisfied: pickleshare==0.7.5 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 42)) (0.7.5)
Requirement already satisfied: pluggy==0.6.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 43)) (0.6.0)
Requirement already satisfied: prometheus-client==0.7.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 44)) (0.7.1)
Requirement already satisfied: prompt-toolkit==2.0.10 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 45)) (2.0.10)
Requirement already satisfied: ptyprocess==0.6.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 46)) (0.6.0)
Requirement already satisfied: py==1.8.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 47)) (1.8.0)
Requirement already satisfied: pycodestyle==2.5.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 48)) (2.5.0)
Requirement already satisfied: pycparser==2.19 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 49)) (2.19)
Requirement already satisfied: pyflakes==2.1.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 50)) (2.1.1)
Requirement already satisfied: Pygments==2.4.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 51)) (2.4.2)
Requirement already satisfied: PyJWT==1.7.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 52)) (1.7.1)
Requirement already satisfied: pymongo==3.7.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 53)) (3.7.2)
Requirement already satisfied: pyrsistent==0.15.4 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 54)) (0.15.4)
Requirement already satisfied: pytest==3.3.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 55)) (3.3.0)
Requirement already satisfied: pytest-flask==0.11.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 56)) (0.11.0)
Requirement already satisfied: python-dateutil==2.8.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 57)) (2.8.0)
Requirement already satisfied: pyzmq==22.3.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 58)) (22.3.0)
Requirement already satisfied: qtconsole==4.5.5 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 59)) (4.5.5)
Requirement already satisfied: Send2Trash==1.5.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 60)) (1.5.0)
Requirement already satisfied: six==1.12.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 61)) (1.12.0)
Requirement already satisfied: terminado==0.8.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 62)) (0.8.2)
Requirement already satisfied: testpath==0.4.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 63)) (0.4.2)
Requirement already satisfied: text-unidecode==1.2 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 64)) (1.2)
Requirement already satisfied: tornado==6.0.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 65)) (6.0.3)
Requirement already satisfied: traitlets==4.3.3 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 66)) (4.3.3)
Requirement already satisfied: wcwidth==0.1.7 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 67)) (0.1.7)
Requirement already satisfied: webencodings==0.5.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 68)) (0.5.1)
Requirement already satisfied: Werkzeug==0.16.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 69)) (0.16.0)
Requirement already satisfied: widgetsnbextension==3.5.1 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 70)) (3.5.1)
Requirement already satisfied: zipp==0.6.0 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from -r requirements.txt (line 71)) (0.6.0)
Requirement already satisfied: colorama in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from ipython==7.8.0->-r requirements.txt (line 21)) (0.4.4)
Requirement already satisfied: setuptools>=18.5 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from ipython==7.8.0->-r requirements.txt (line 21)) (58.1.0)
Requirement already satisfied: pywinpty>=0.5 in c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages (from terminado==0.8.2->-r requirements.txt (line 62)) (1.1.6)

When I google around, I found
“collections.Iterable is deprecated. Replace it with collections.abc.Iterable.”

Thanks,

Johnny

Hi,

I solved the problem by the correcting the codes from:

isinstance(obj, collections.Iterable)

to

isinstance(obj, collections.abc.Iterable)

in the file core.py.
.\M220P\mflix-python\mflix_venv\Lib\site-packages\flask_cors\core.py

and reference to the following website
https://docs.python.org/3/library/collections.abc.html

Thanks,

Johnny

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.