PyLint 1.2.1 - AttributeError: 'Module' 对象没有属性 'future_imports
我已经使用PyLint很多年了,最近在Python 2.7.6上安装了PyLint 1.2.1。
当我在PyScripter 2.5.3中运行PyLint 1.2.1来检查任何Python脚本时,出现了错误日志:
Command line: D:\PROGRA~1\Python27\python.exe D:\PROGRA~1\Python27\Lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\lint.py "E:\test\dotnetver.py" --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"
Working directory:
Timeout: 0 ms
************* Module dotnetver
E:\test\dotnetver.py:2: [I0011(locally-disabled), ] Locally disabling missing-docstring (C0111)
No config file found, using default configuration
Traceback (most recent call last):
File "D:\PROGRA~1\Python27\Lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\lint.py", line 1106, in <module>
Run(sys.argv[1:])
File "D:\PROGRA~1\Python27\Lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\lint.py", line 1051, in __init__
linter.check(args)
File "D:\PROGRA~1\Python27\Lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\lint.py", line 626, in check
self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
File "D:\PROGRA~1\Python27\Lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\lint.py", line 708, in check_astroid_module
checker.process_module(astroid)
File "D:\PROGRA~1\Python27\lib\site-packages\pylint-1.2.1-py2.7.egg\pylint\checkers\format.py", line 477, in process_module
if 'print_function' in module.future_imports:
AttributeError: 'Module' object has no attribute 'future_imports'
Process "Pylint" terminated, ExitCode: 00000001
这是新版本的PyLint有问题,还是我漏掉了什么呢?
2 个回答
0
如果你在使用Debian或者它的衍生版,你可能需要特别运行一下 apt-get install python-astroid
这个命令。因为在安装pylint的时候,这个包并没有自动更新。
3
升级了astroid之后,pylint也升级了,这个问题就解决了。
pip install --upgrade astroid