2to3 ParseError in python file

血红的双手。 提交于 2019-12-11 12:28:03

问题


I tried running 2to3 on a python file however it is failing with following error, i am not able to understand where exactly in the problem any help is appreciated.

[adsf@localhost direct]$ 2to3 ./views/statusformatter.py 
RefactoringTool: Skipping implicit fixer: buffer 
RefactoringTool: Skipping implicit fixer: idioms 
RefactoringTool: Skipping implicit fixer: set_literal 
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Can't parse ./views/statusformatter.py: ParseError:
bad input: type=22, value=u'=', context=('', (338, 31))
RefactoringTool: No files need to be modified. 
RefactoringTool: There was 1 error: 
RefactoringTool: Can't parse ./views/statusformatter.py:
ParseError: bad input: type=22, value=u'=', context=('', (338, 31))

回答1:


As answered by @wovano in my question regarding a similar (or as the matter of fact, probably the same) problem, 2to3 fails to parse as this is a proper Python 3 syntax and not Python 2. In my particular case, and as it seems it could be a case also here, it was named argument of the print function that does not exist in Python 2.



来源:https://stackoverflow.com/questions/56523611/2to3-parseerror-in-python-file

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