python文件中的2to3 ParseError

时间:2019-06-10 09:21:02

标签: python-3.x python-2.x python-2to3

我尝试在python文件上运行2to3,但是由于以下错误而失败,我无法理解在任何问题上可以得到帮助的确切位置。

[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 个答案:

答案 0 :(得分:1)

@wovano在my question中针对类似(或实际上可能是相同的)问题进行了回答,2to3无法解析,因为这是正确的Python 3语法,而不是Python 2.在我的特殊情况下,在这里似乎也可能是这种情况,它被命名为print函数的参数,在Python 2中不存在。