Reputation: 1709
Since two days ago I receive this the moment I try to import flask_apispec.extension:
>>> import flask_apispec.extension
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\MyUser\AppData\Local\pypoetry\Cache\virtualenvs\gfp-LphObOQn-py3.9\lib\site-packages\flask_apispec\__init__.py", line 1, in <module>
from flask_apispec.views import ResourceMeta, MethodResource
File "C:\Users\MyUser\AppData\Local\pypoetry\Cache\virtualenvs\gfp-LphObOQn-py3.9\lib\site-packages\flask_apispec\views.py", line 41, in <module>
class MethodResourceMeta(ResourceMeta, flask.views.MethodViewType):
AttributeError: module 'flask.views' has no attribute 'MethodViewType'
I'm attempting to import it after apispec and marshmallow (libraries were installed using poetry):
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
import flask_apispec.extension
I have the following versions:
apispec = "^5.2.2"
Flask = "2.1.1"
flask_apispec = "0.11.1"
Different versions didn't help, resetting the environment didn't help either...
Upvotes: 2
Views: 2300
Reputation: 726
Flask has removed MethodViewType
from flask.views and flask-apispec
still uses it.
There is a PR for flask-apispec
that may fix it, but as writing this answer, it is not merged into the main branch. You may try it by running
pip install git+https://github.com/jmcarp/flask-apispec.git@refs/pull/238/merge
More info on MethodViewType
removal
Upvotes: 4