cenkalti / github-flask

🍾 Flask extension for GitHub API

Home Page:https://github-flask.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: __name__ must be set to a string object

chuck-bass opened this issue · comments

Here is the problem:

The current environment is py2.7 , and i wanna write code capable of python3. So i add "from future import unicode_literals" on the top of file.Meanwhile, i use MethodView to build rest api in the same file.
However, when i run the web app, it thows the error,

"lib/python2.7/site-packages/flask/views.py", line 102, in as_view
view.__name__ = name
TypeError: __name__ must be set to a string object". 

I soon realize that because i use the "from future import unicode_literals" in py2 so the function name is unicode type, but the name of a function should be string type.So i wonder could we change the
source code and add the if-then workflow to convert name of function from unicode type into string type to handle the situation .

sorry , it seems that i add the issue in the wrong place.