[Python-projects] pylint: (missing) namespace package handling / TypeError: '_Yes' object is unindexable

Sylvain Thénault sylvain.thenault at logilab.fr
Mon Mar 30 11:31:06 CEST 2009


Le Monday 30 March 2009 11:26:21 Jürgen Hermann, vous avez écrit :
> Hi, 

Hi Jürgen,

> after upgrading from 0.14 to 0.18 since 0.14 had problems handling a 
> project using namespace packages, all I get is following traceback.
>
> Traceback (most recent call last):
>   File "./bin/pylint", line 5, in <module>
>     pkg_resources.run_script('pylint==0.18.0', 'pylint')
>   File
[snip]
> "./lib/python2.5/site-packages/pylint-0.18.0-py2.5.egg/pylint/checkers/vari
>ables.py", line 460, in _check_module_attrs module =
> module.getattr(name)[0].infer().next()
> TypeError: '_Yes' object is unindexable

could you extract a minimal snippet of code reproducing this ?

> Changing the except clause for E0611 in variables.py to include "TypeError"
> yields this:
>
> ************* Module ui_portal.tools.servercontrol.java.tomcat
> E0611: 16: No name 'utils' in module YES
> F0401: 16: Unable to import 'ui_portal.commons.utils.adt' (No module named
> commons) E0611: 17: No name 'servercontrol' in module YES
>
> Seems the problem of 0.14 to handle namespace packages persists and is even
> worse.
>
> The project structure is as follows:
>  * ui_portal, ui_portal.tools and ui_portal.commons are all namespace
> packages * ui_portal.tools.servercontrol is the main project defining
> "ui_portal", "ui_portal.tools" as its namespace packages (in setup.py) * it
> depends on ui_portal.commons.utils, which defines "ui_portal",
> "ui_portal.commons" as its namespace packages (in setup.py)
>
> My assumption is that pylint fails as soon as you have a project that
> includes another egg sharing parts of the same namespace packages (in this
> case "ui_portal"). The "ui_portal.commons.utils" project works without
> problems (no dependencies to other projects in the "ui_portal" namespace).
> Another project that also has such a dependency shows the same symptoms. If
> I change one of the tools projects to include the library using
> "ui_portal_commons" instead of "ui_portal.commons" as the namespace, pylint
> works.

true, neither pylint nor astng has ever understood namespace packages as 
understood by setuptools. I guess it has to do so, even if this is far from 
motivating me... BTW, is there something else than the crash you encountered 
that make you tell namespace packages pb is worse in 0.18?

I've added a ticket for the namespace packages pb: 
http://www.logilab.org/ticket/8796

If you could send me a snippet of code to reproduce the crash, that would be 
great so I can quickly fix it. 

regards,
-- 
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