[Python-projects] Bug in pylint: crash when parsing "import matplotlib.figure"

David Kiliani mail at davidkiliani.de
Wed Nov 26 16:34:32 CET 2008


Hi,

I think I found a bug in pylint when importing matplotlib.figure:

Pylint: Executing command line:' /usr/bin/pylint --include-ids=y
/home/dk/Projects/python/lusci/lusci.py '
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/logilab/astng/manager.py", line
109, in astng_from_file
    astng = ASTNGBuilder(self).file_build(filepath, modname)
  File "/usr/lib/python2.5/site-packages/logilab/astng/builder.py", line
220, in file_build
    node = self.string_build(data, modname, path)
  File "/usr/lib/python2.5/site-packages/logilab/astng/builder.py", line
230, in string_build
    return self.ast_build(parse(data + '\n'), modname, path)
  File "/usr/lib/python2.5/site-packages/logilab/astng/builder.py", line
253, in ast_build
    getattr(self, 'delayed_visit_%s' %
dnode.__class__.__name__.lower())(dnode)
  File "/usr/lib/python2.5/site-packages/logilab/astng/builder.py", line
470, in delayed_visit_assattr
    for infered in node.expr.infer():
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/__init__.py",
line 122, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/__init__.py",
line 122, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 274, in infer_callfunc
    for callee in self.node.infer(context):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 298, in infer_getattr
    for owner in self.expr.infer(context):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/__init__.py",
line 122, in _infer_stmts
    for infered in stmt.infer(context):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 45, in wrapped
    for res in _func(node, context, **kwargs):
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 342, in infer_import
    yield _imported_module_astng(self, self.real_name(name))
  File "/usr/lib/python2.5/site-packages/logilab/astng/inference.py",
line 332, in _imported_module_astng
    return mymodule.import_module(modname)
  File "/usr/lib/python2.5/site-packages/logilab/astng/scoped_nodes.py",
line 255, in import_module
    return MANAGER.astng_from_module_name(self.relative_name(modname))
  File "/usr/lib/python2.5/site-packages/logilab/astng/manager.py", line
137, in astng_from_module_name
    module = load_module_from_name(modname)
  File "/usr/lib/python2.5/site-packages/logilab/common/modutils.py",
line 106, in load_module_from_name
    return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
  File "/usr/lib/python2.5/site-packages/logilab/common/modutils.py",
line 149, in load_module_from_modpath
    module = load_module(curname, mp_file, mp_filename, mp_desc)
  File "/usr/lib/python2.5/site-packages/matplotlib/__init__.py", line
128, in <module>
    from rcsetup import defaultParams, validate_backend, validate_toolbar
  File "/usr/lib/python2.5/site-packages/matplotlib/rcsetup.py", line
19, in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib/python2.5/site-packages/matplotlib/colors.py", line 39,
in <module>
    import matplotlib.cbook as cbook
  File "/usr/lib/python2.5/site-packages/matplotlib/cbook.py", line 6,
in <module>
    import re, os, errno, sys, StringIO, traceback, locale, threading, types
  File "/usr/lib/python2.5/threading.py", line 13, in <module>
    from collections import deque
  File "/usr/lib/python2.5/site-packages/matplotlib/collections.py",
line 15, in <module>
    import matplotlib.cbook as cbook
AttributeError: 'module' object has no attribute 'cbook'

The problem seems to be that threading.py imports "collections" which is
resolved to matplotlib.collections, probably not intended that way...

$ pylint --version
No config file found, using default configuration
pylint 0.14.0,
astng 0.17.2, common 0.31.0
Python 2.5.2 (r252:60911, Nov  1 2008, 18:01:20)
[GCC 4.3.2]




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20081126/612787ce/attachment.pgp 


More information about the Python-Projects mailing list