1

我正在尝试使用 pylint 为 jython 代码生成 uml 图表。如果我在纯 python 代码上运行它,一切都运行良好,但是一旦我尝试在包含 swing 导入的代码上运行它,它就会崩溃并显示错误消息。

我在 Jython 的 python(!) 上运行 pylint,它不会运行 (2.7.2a)。如何让 pylint(特别是 pyreverse)运行?目前它写出所有文件名然后失败(我怀疑是因为它无法检查java pacakges(swing)我该如何解决这个问题?

错误信息

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?
4

1 回答 1

1

这实际上是一个与 jython 无关的错误,最近已在 logilab-astng 的存储库中修复。此修复尚未发布,同时您仍然可以使用 mercurial checkout:http ://hg.logilab.org/logilab/astng (默认分支)

于 2012-07-02T06:47:53.823 回答