[Python-projects] visit_import bug
Sylvain Thénault
sylvain.thenault at logilab.fr
Tue Feb 12 09:23:54 CET 2008
On Mon, Feb 11, 2008 at 12:36:22PM -0800, Robert Kirkpatrick wrote:
> Hi Guys,
Hi Rob,
> I run into this error:
>
> robertk01> pylint process_single_lane.py
> No config file found, using default configuration
> ************* Module process_single_lane
> C: 36: Line too long (91/80)
> C:163: Line too long (107/80)
> C:167: Line too long (115/80)
> W:308: Found indentation with tabs instead of spaces
> C:337: Line too long (97/80)
> C:556: Line too long (131/80)
> C:558: Line too long (166/80)
> C: 1: Missing docstring
> Traceback (most recent call last):
> File "/Library/Frameworks/Python.framework/Versions/Current/bin/pylint",
> line 4, in <module>
> lint.Run(sys.argv[1:])
[snip]
> File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packag
> es/pylint/checkers/variables.py", line 359, in visit_import
> module = node.infer_name_module(parts[0]).next()
> AttributeError: Import instance has no attribute 'infer_name_module'
>
> But if I change the section of visit_import() in variables.py to comment out
> the try/except, I can run pylint ok:
>
> def visit_import(self, node):
> """check modules attribute accesses"""
> for name, _ in node.names:
> parts = name.split('.')
> #try:
> # import pdb; pdb.set_trace();
> # module = node.infer_name_module(parts[0]).next()
> #except astng.ResolveError:
> # continue
> continue
> self._check_module_attrs(node, module, parts[1:])
>
>
> I noticed in the log that this was worked on in revision 144 but I have no
> idea what this code actually does or how to address it other than what I
> did.
>
> I also don't know if there is something weird with the code on my end or if
> my code is highlighting a bug.
hum, probably a bug. Could you extract from the file causing the crash a
short snippet demonstrating the crash? Also, astng is adding the
infer_name_module method to Import node, so I find this attribute error
weird. Is your logilab.astng package up to date as well ?
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list