python文件中的2to3解析错误 [英] 2to3 ParseError in python file

查看:32
本文介绍了python文件中的2to3解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 python 文件上运行 2to3 但是它失败并出现以下错误,我无法理解问题的确切位置,感谢任何帮助.

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))

推荐答案

正如@wovano 在我的问题中回答的那样一个类似的(或者事实上,可能是相同的)问题,2to3 无法解析,因为这是一个正确的 Python 3 语法而不是 Python 2.在我的特殊情况下,似乎它也可能是这种情况,它被命名为 Python 2 中不存在的 print 函数的参数.

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.

这篇关于python文件中的2to3解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆