我正在尝试使用pylint为jython代码生成uml图表。如果我在普通的python代码上运行它,一切运行正常,但是一旦我尝试在包含swing导入的代码上运行它,它就会崩溃并显示错误消息。
我在Jython中运行python(!)上的pylint它不会运行(2.7.2a)。如何运行pylint(特别是pyreverse)?目前它写出所有文件名然后失败(我怀疑因为它无法检查java pacakges(swing)如何解决这个问题?
ERRORMESSAGE :
Traceback (most recent call last): File "/usr/bin/pyreverse", line 4, in <module> main.Run(sys.argv[1:])
File "/usr/lib/python2.7/dist-packages/pylint/pyreverse/main.py", line 126, in __init__ PyreverseCommand(args)
File "/usr/lib/python2.7/dist-packages/pylint/pyreverse/main.py", line 98, in __init__ self.run(args)
File "/usr/lib/python2.7/dist-packages/pylint/pyreverse/main.py", line 112, in run diadefs = handler.get_diadefs(project, linker)
File "/usr/lib/python2.7/dist-packages/pylint/pyreverse/diadefslib.py", line 228, in get_diadefs diagrams = DefaultDiadefGenerator(linker, self).visit(project)
File "/usr/lib/python2.7/dist-packages/logilab/astng/utils.py", line 103, in visit self.visit(local_node)
File "/usr/lib/python2.7/dist-packages/logilab/astng/utils.py", line 100, in visit methods[0](node)
File "/usr/lib/python2.7/dist-packages/pylint/pyreverse/diadefslib.py", line 161, in visit_module self.linker.visit(node)
File "/usr/lib/python2.7/dist-packages/logilab/astng/utils.py", line 103, in visit self.visit(local_node)
File "/usr/lib/python2.7/dist-packages/logilab/astng/utils.py", line 100, in visit methods[0](node) File "/usr/lib/python2.7/dist-packages/logilab/astng/inspector.py", line 257, in visit_from fullname = get_module_part(fullname)
File "/usr/lib/python2.7/dist-packages/logilab/common/modutils.py", line 334, in get_module_part
'explicit relative import, but no context_file?' AssertionError: explicit relative import, but no context_file?
答案 0 :(得分:1)
这实际上是一个与jython无关的bug,最近已经在logilab-astng的存储库中修复了。此修复程序尚未发布,与此同时您仍然可以使用mercurial checkout:http://hg.logilab.org/logilab/astng(默认分支)