Hello,
I'm forwarding the Debian bug 591676
$ echo 'import icu' > test.py
$ pylint test.py No config file found, using default configuration
************* Module test
C: 1: Missing docstring
Traceback (most recent call last):
File "/usr/bin/pylint", line 4, in
lint.Run(sys.argv[1:])
File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 856, in __init__
linter.check(args)
File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 488, in check
self.check_astng_module(astng, walker, rawcheckers)
File "/usr/lib/pymodules/python2.6/pylint/lint.py", line 563, in check_astng_module
walker.walk(astng)
File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 516, in walk
self.walk(child)
File "/usr/lib/pymodules/python2.6/pylint/utils.py", line 513, in walk
cb(astng)
File "/usr/lib/pymodules/python2.6/pylint/checkers/imports.py", line 224, in visit_import
importedmodnode = self.get_imported_module(modnode, node, name)
File "/usr/lib/pymodules/python2.6/pylint/checkers/imports.py", line 260, in get_imported_module
return importnode.do_import_module(modname)
File "/usr/lib/pymodules/python2.6/logilab/astng/mixins.py", line 147, in do_import_module
return mymodule.import_module(modname, level=level)
File "/usr/lib/pymodules/python2.6/logilab/astng/scoped_nodes.py", line 355, in import_module
return MANAGER.astng_from_module_name(absmodname)
File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 183, in astng_from_module_name
return self.astng_from_file(filepath, modname, fallback=False)
File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 140, in astng_from_file
return ASTNGBuilder(self).file_build(filepath, modname)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 135, in file_build
node = self.string_build(data, modname, path)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 145, in string_build
return self.ast_build(parse(data + '\n'), modname, path)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 158, in ast_build
newnode = self.rebuilder.build(node, modname, node_file)
File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 112, in build
self._add_from_names_to_locals(from_node, delayed=True)
File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 211, in _add_from_names_to_locals
imported = node.root().import_module(node.modname)
File "/usr/lib/pymodules/python2.6/logilab/astng/scoped_nodes.py", line 355, in import_module
return MANAGER.astng_from_module_name(absmodname)
File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 183, in astng_from_module_name
return self.astng_from_file(filepath, modname, fallback=False)
FNameError: name 'BreakIterator' is not definedile "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 140, in astng_from_file
return ASTNGBuilder(self).file_build(filepath, modname)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 135, in file_build
node = self.string_build(data, modname, path)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 145, in string_build
return self.ast_build(parse(data + '\n'), modname, path)
File "/usr/lib/pymodules/python2.6/logilab/astng/builder.py", line 158, in ast_build
newnode = self.rebuilder.build(node, modname, node_file)
File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 112, in build
self._add_from_names_to_locals(from_node, delayed=True)
File "/usr/lib/pymodules/python2.6/logilab/astng/rebuilder.py", line 211, in _add_from_names_to_locals
imported = node.root().import_module(node.modname)
File "/usr/lib/pymodules/python2.6/logilab/astng/scoped_nodes.py", line 355, in import_module
return MANAGER.astng_from_module_name(absmodname)
File "/usr/lib/pymodules/python2.6/logilab/astng/manager.py", line 176, in astng_from_module_name
module = load_module_from_name(modname)
File "/usr/lib/pymodules/python2.6/logilab/common/modutils.py", line 113, in load_module_from_name
return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
File "/usr/lib/pymodules/python2.6/logilab/common/modutils.py", line 153, in load_module_from_modpath
module = load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/lib/pymodules/python2.6/icu.py", line 37, in
from docs import *
File "/usr/lib/pymodules/python2.6/docs.py", line 27, in
_install__doc__(BreakIterator, '''
NameError: name 'BreakIterator' is not defined
|
Comments
-
2010/08/16 10:31, written by sthenault
-
2010/10/21 12:17, written by eanclin
-
2010/10/21 12:25, written by sthenault
-
2010/09/25 13:07, written by anon
add commentweird... IMO the first thing to understand is why pylint try to import the icu module instead of building its ast from sources.
Python sources file are available, right ?
Also, is BreakIterator actually defined in the docs module ?
when building the tree for icu, astng discovers the "from _icu import * " in docs.py . since _icu is a binary module, astng tries to import the module for building from "living object". BreakIterator is only defined, if we import icu or docs. If we import _icu directly, we get:
I don't know what we should do here ...
probably nothing and let icu authors fix this.
yes, sources files are there, along with the pyc files:
{{{
$ ls /usr/lib/pymodules/python2.6/icu.py* -l
lrwxrwxrwx 1 root root 26 Sep 25 15:04 /usr/lib/pymodules/python2.6/icu.py -> /usr/share/pyshared/icu.py
-rw-r--r-- 1 root root 906 Sep 25 15:04 /usr/lib/pymodules/python2.6/icu.pyc
}}}
for BreakIterator, yes, it's there.