PyLint 1.2.1 - AttributeError:'Module'对象没有属性'future_imports'

时间:2014-07-24 11:52:37

标签: python pylint

我正在使用PyLint多年,并且刚刚在Python 2.7.6上安装了PyLint 1.2.1

当我在任何Python脚本上运行PyLint 1.2.1(在PyScripter 2.5.3中)时,我收到错误日志:

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版本中的Bug还是我错过了什么?

2 个答案:

答案 0 :(得分:2)

升级astroid在pylint升级后修复此问题

pip install  --upgrade astroid

答案 1 :(得分:0)

如果使用Debian或其衍生版本,则可能需要专门apt-get install python-astroid。它不是pylint的安装会自动更新的软件包之一。