On Wed, 2014-11-26 at 22:06 +0100, Torsten Marek wrote: > Hm, this might be a problem with standard library detection on with > self-built Python installations.
> Can you give me the output of: > >>> import sys > >>> sys.path > >>> from astroid import modutils > >>> modutils.STD_LIB_DIRS > >>> modutils.is_standard_module('time') See below. I had a few minutes to play with this and I discovered that the version of Python and the version of logilab-common don't matter. If I keep Python 2.7.8 and logilab-common 0.63.0 but down-rev pylint to 1.1.0 and astroid to 1.0.1, then things start to work again. However if I upgrade EITHER (or both) of pylint (to 1.4.0) or astroid (to 1.3.2) then I see the bad behavior. That seems odd to me, but that's what I see. Here's the output you asked for from the failing install (this uses pylint 1.1.0 and astroid 1.3.2): Python 2.7.8 (default, Nov 25 2014, 22:45:58) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/opt/python/lib/python2.7/site-packages/setuptools-7.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/docopt-0.6.2-py2.7.egg', '/opt/python/lib/python2.7/site-packages/paramiko-1.15.1-py2.7.egg', '/opt/python/lib/python2.7/site-packages/ecdsa-0.11-py2.7.egg', '/opt/python/lib/python2.7/site-packages/scp-0.8.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/boto-2.34.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/logilab_common-0.63.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/six-1.8.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/astroid-1.3.2-py2.7.egg', '/opt/python/lib/python2.7/site-packages/pylint-1.1.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/requests-2.4.3-py2.7.egg', '/opt/python/lib/python2.7/site-packages/selenium-2.44.0-py2.7.egg', '/opt/python/lib/python2.7/site-packages/oauthlib-0.7.2-py2.7.egg', '/opt/python/lib/python2.7/site-packages/requests_oauthlib-0.4.2-py2.7.egg', '/opt/python/lib/python2.7/site-packages/jira_python-0.16-py2.7.egg', '/opt/python/lib/python27.zip', '/opt/python/lib/python2.7', '/opt/python/lib/python2.7/plat-linux2', '/opt/python/lib/python2.7/lib-tk', '/opt/python/lib/python2.7/lib-old', '/opt/python/x86_64-linux/lib/python2.7/lib-dynload', '/opt/python/lib/python2.7/site-packages', '/opt/python/x86_64-linux/lib/python2.7/site-packages'] >>> from astroid import modutils >>> modutils.STD_LIB_DIRS ['/opt/python/lib/python2.7', '/opt/python/lib/python2.7'] >>> modutils.is_standard_module('time') False Hm. Why are both paths in STD_LIB_DIRS the same? Should one of them be the execprefix path? Aha! If I reset STD_LIB_DIRS like this: >>> modutils.STD_LIB_DIRS = ['/opt/python/lib/python2.7', '/opt/python/x86_64-linux/lib/python2.7'] Then I get: >>> modutils.is_standard_module('time') True So the problem appears to be that when I install Python I'm separating prefix and exec_prefix, and astroid is not grokking that: >>> sys.prefix '/opt/python' >>> sys.exec_prefix '/opt/python/x86_64-linux' > 2014-11-26 15:41 GMT+01:00 Paul Smith > <p...@mad-scientist.net>: > On Wed, 2014-11-26 at 02:03 -0500, Paul Smith wrote: > > Forgot to say, I'm running on GNU/Linux Ubuntu GNOME > 14.10 and I've > built all these tools (including python) myself from > source. > > > Hi all; I just upgraded to a newer version of pylint > and now I'm seeing > > many spurious E1101 errors. > > > > Before I was using: > > * Python 2.7.6 > > * Pylint 1.1.0 > > * Astroid 1.0.1 > > * logilab-common 0.61.0 > > > > Now I've upgraded to: > > * Python 2.7.8 > > * Pylint 1.4.0 > > * Astroid 1.3.2 > > * logilab-common 0.63.0 > > > > Everything about this new install appears to work > fine, EXCEPT pylint. > > > > I'm seeing tons of strange E1101 error on standard > modules, like > > time.sleep() and others (readline, etc.) For > example: > > > > $ cat sl.py > > import time > > time.sleep(1) > > > > $ python sl.py > > <sleeps for 1s successfully> > > > > $ pylint sl.py > > ************* Module sl > > C: 1, 0: Missing module docstring > (missing-docstring) > > E: 2, 0: Module 'time' has no 'sleep' member > (no-member) > > > > If I run this with my old setup (older > python/pylint/etc.), it doesn't > > complain at all. Why am I seeing this invalid > error? > > > By "at all" I mean it doesn't complain about > time.sleep(); of course I > still get the missing docstring message in the old > version :-). > > Looking at this it seems like all the members which > are loaded from a > shared library (e.g., > lib/python2.7/lib-dynload/time.so etc.) have this > problem: I see it with datetime, readline, some socket > stuff, etc. > > Did I break something with my installation of python > or one of the > packages? How does pylint normally discover module > members when the > implementation is in C rather than python? > > _______________________________________________ > code-quality mailing list > code-quality@python.org > https://mail.python.org/mailman/listinfo/code-quality > > > > > _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality