问题
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