2013-03-19 1 views
2

이 일반적인 질문은 새로운 것이 아니라는 것을 알고 있었지만 내 개인적인 문제로 보입니다.Windows 7 및 Python 3.3에서 pylint 실행 시도

필자는 Python 3.3 용 Windows 7에서 pylint를 설치하려고합니다. (예, 지원되지 않지만 사용 가능하다는 것을 알고 있습니다. 제 동료가 그랬기 때문에 슬프게도 알려진 문제에 대한 해결책이 효과가 없었습니다. 내 PC - 그는 Windows 8 ...)

현재 Python 3.3을 설치했으며 처음에는 pip를 통해 pylint를 설치하려고했으나 실패했습니다.

수색 내 동료와 일부 회담이 대답 가져 : No luck pip-installing pylint for Python 3

나는이 지침 pylint를 설치하려면 관리를하지만, dependecies (logilab-astng) 중 하나가 실패했습니다.

setup.py 스크립트를 검사하고 "2to3"변환이 내 컴퓨터에서 실행되지 않는다는 것을 알았습니다. (나는 경로 문제로 생각합니다) - 변환을 재구성하여 실행했습니다.

이후 모든 설치 과정은 (pylint는 logilab-astng는 logilab - 일반)는 "성공"종료 -하지만 난 pylint를 시작하면 나는이 메시지를 가지고 : 나는 당신의 아이디어를 기대하고

G:\Path\to\project>pylint --rcfile .\pylint.rc modulename 
Traceback (most recent call last): 
    File "C:\Program Files (x86)\Python33\Scripts\pylint-script.py", line 9, in <module> 
    load_entry_point('pylint==0.27.0', 'console_scripts', 'pylint')() 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\__init__.py", line 21, in run_pylint 
    Run(sys.argv[1:]) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 991, in __init__ 
    linter.check(args) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 587, in check 
    self.check_astng_module(astng, walker, rawcheckers) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\lint.py", line 666, in check_astng_module 
    walker.walk(astng) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\utils.py", line 600, in walk 
    self.walk(child) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\utils.py", line 597, in walk 
    cb(astng) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\pylint-0.27.0-py3.3.egg\pylint\checkers\variables.py", line 510, in visit_import 
    module = next(node.infer_name_module(parts[0])) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\bases.py", line 304, in wrapped 
    for res in _func(node, context, **kwargs): 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\inference.py", line 181, in infer_imp 
ort 
    yield self.do_import_module(name) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\mixins.py", line 117, in do_import_mo 
dule 
    return mymodule.import_module(modname, level=level) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\scoped_nodes.py", line 342, in import 
_module 
    return MANAGER.astng_from_module_name(absmodname) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\manager.py", line 136, in astng_from_ 
module_name 
    return self.astng_from_file(filepath, modname, fallback=False) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\manager.py", line 107, in astng_from_ 
file 
    return ASTNGBuilder(self).file_build(filepath, modname) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 129, in file_build 
    node = self.string_build(data, modname, path) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 135, in string_buil 
d 
    module = self._data_build(data, modname, path) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\builder.py", line 162, in _data_build 

    module = self.rebuilder.visit_module(node, modname, package) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 616, in visit_mod 
ule 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 616, in <listcomp 
> 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit 
    return self._visit_meths[cls](node, parent) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 471, in visit_fun 
ction 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 471, in <listcomp 
> 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit 
    return self._visit_meths[cls](node, parent) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 450, in visit_for 

    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 450, in <listcomp 
> 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit 
    return self._visit_meths[cls](node, parent) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 540, in visit_if 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 540, in <listcomp 
> 
    newnode.body = [self.visit(child, newnode) for child in node.body] 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 137, in visit 
    return self._visit_meths[cls](node, parent) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 391, in visit_dis 
card 
    newnode.value = self.visit(node.value, newnode) 
    File "C:\Program Files (x86)\Python33\lib\site-packages\logilab_astng-0.24.2-py3.3.egg\logilab\astng\rebuilder.py", line 141, in visit 
    visit_method = getattr(self, visit_name) 
AttributeError: 'TreeRebuilder3k' object has no attribute 'visit_yieldfrom' 

을!

답변

0

문제는 pylint에서 사용되는 ast 표현을 포함하는 logilab-astng는 아직 python 3.3에 도입 된 "yieldfrom"노드를 지원하지 않는다는 것입니다.

당신은이 문제를 해결해야한다, 패치 아래에 시도 할 수 있습니다 :

diff --git a/rebuilder.py b/rebuilder.py 
--- a/rebuilder.py 
+++ b/rebuilder.py 
@@ -877,10 +877,12 @@ class TreeRebuilder3k(TreeRebuilder): 
      newnode.handlers = [self.visit(child, newnode) for child in node.handlers] 
      newnode.orelse = [self.visit(child, newnode) for child in node.orelse] 
     newnode.set_line_info(newnode.last_child()) 
     return newnode 

+ def visit_yieldfrom(self, node, parent): 
+  return self.visit_yield(node, parent) 

if sys.version_info >= (3, 0): 
    TreeRebuilder = TreeRebuilder3k 
+0

패치가 게시 된 문제를 제거하지만, 또 다른이 발생합니다 KeyError를 ('cherrypy.process', 없음) logilab_astng-의를 0.24.2-py3.3.egg \ logilab \ astng \ manager.py "164 행의 file_from_module_name – Manuel

+0

이 새로운 주에 대해 새 질문을 열어야합니까? – Manuel

관련 문제