ImportError: cannot import name is_python_keyword

我们两清 提交于 2019-12-12 16:57:49

问题


I am trying to execute a python script , but I get an error on line

from jinja2.utils import Markup, concat, escape, is_python_keyword, next

ImportError: cannot import name is_python_keyword

I checked there is no file named is_python.py


回答1:


Looking at the source code for 2.3.1 they have a line:

from keyword import iskeyword as is_python_keyword

They are using the builtin keyword module.

The current version is 2.7.3 so it seems they have changed the code and it is no longer available.

You could use the above import from the builtin module instead.



来源:https://stackoverflow.com/questions/28429229/importerror-cannot-import-name-is-python-keyword

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!