To solve ImportError cannot import name ‘_endpoint_from_view_func’ from ‘flask.helpers’ error follow below methods. The issue is caused by running the below code :
from flask_restful import reqparse, Api, Resource
ERROR LOG
Exception has occurred: ImportError
cannot import name '_endpoint_from_view_func' from 'flask.helpers' (C:\Users\xyz\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\helpers.py)
File "E:\project\api\api2.py", line 72, in <module>
from flask_restful import reqparse, Api, Resource
Contents
How to solve ImportError cannot import name ‘_endpoint_from_view_func’ from ‘flask.helpers’ ?
To solve the ImportError cannot import name ‘_endpoint_from_view_func’ from ‘flask.helpers’ error you can do monkey patching as shown below:
import flask.scaffold
flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func
import flask_restful
the current version of my Flask-RESTful
package is 0.3.8
. You can check the current installed version of flask-restful using pip show flask-restful
Since the current error has then been fixed in release 0.3.9
version, just upgrade the Flask-RESTful package version:
Flask-RESTful>0.3.8
Alternative to Solve
The error can be fixed using the recent version of Flask-RESTful
.
For example:
Flask-RESTful==0.3.9
Hope the above solution works.
Also read :
Your bundle is locked to mimemagic (0.3.5) but that version could not be found in any of the sources listed in your Gemfile.
fatal error: server could not be contacted when running pgAdmin4. ‘NoneType’ object has no attribute ‘value’