简体   繁体   中英

pylint PyQt4 error

I write a program :

from PyQt4.QtCore import *
from PyQt4.QtGui import *

def main():
    app = QApplication([])
    button = QPushButton("hello?")
    button.show()
    app.exec_()

if __name__=="__main__":
    main()

the file name is t.py, when I run:

pylint t.py

in ubuntu9.10, pyqt4, I got this:

pylint t.py
No config file found, using default configuration
error while building astng for /home/halida/data/workspace/test/t.py
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 126, in astng_from_file
    astng = ASTNGBuilder(self).file_build(filepath, modname)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 118, in file_build
    node = self.string_build(data, modname, path)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 128, in string_build
    return self.ast_build(parse(data + '\n'), modname, path)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 147, in ast_build
    self.rebuilder.walk(node)
  File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 89, in walk
    self._walk(node)
  File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 109, in _walk
    self._walk(child, node)
  File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 103, in _walk
    handle_leave = node.accept(self)
  File "/usr/lib/pymodules/python2.6/logilab/astng/nodes.py", line 159, in accept
    return func(self)
  File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 188, in visit_from
    imported = node.root().import_module(node.modname)
  File "/usr/lib/pymodules/python2.6/logilab/astng/scoped_nodes.py", line 282, in import_module
    return MANAGER.astng_from_module_name(self.relative_name(modname, level))
  File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 172, in astng_from_module_name
    return self.astng_from_module(module, modname)
  File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 207, in astng_from_module
    astng = ASTNGBuilder(self).module_build(module, modname)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 80, in module_build
    node = self.inspect_build(module, modname=modname, path=path)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 95, in inspect_build
    self.object_build(node, module)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 195, in object_build
    self.object_build(class_node, member)
  File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 198, in object_build
    object_build_methoddescriptor(node, member)
  File "/usr/lib/pymodules/python2.6/logilab/astng/raw_building.py", line 150, in object_build_methoddescriptor
    func = build_function(member.__name__, doc=member.__doc__)
AttributeError: 'PyQt4.QtCore.pyqtSignal' object has no attribute '__name__'
************* Module t
F:  1: <class 'logilab.astng._exceptions.ASTNGBuildingException'>: Unable to load module t ('PyQt4.QtCore.pyqtSignal' object has no attribute '__name__')

Compilation exited abnormally with code 1 at Sat Dec 26 10:43:54

in windows XP, with pythonxy,

I only got a error message, why?

Looks like a bug in astng . They try to read the name of a function which does not publish it (native extension func). I'd report a bug to both astng and pyqt projects. The first one would be that they should handle a no-name situation better. The second one would be that every sane extension should publish at least the function names.

我会检查您是否正在使用最新的astng,pylint等。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM