dubmojo
dubmojo

Reputation: 6838

Running Pylint on Windows -> ImportError: cannot import from builtins

Maybe someone has a clue about this one. Google, the Logilab.org archives and every other source I tried to determine a solution have turned up empty.

I was trying to get Pylint 2.4 running with PyDev in Eclipse (with Python 2.6) on Windows, but right now I'd be happy simply running pylin at all. I used easy_install to install pylint and it's dependancies. That seemed to work fine. However if I try to run c:\python26\Scripts\pylint.bat , I get the following:

Traceback (most recent call last):
  File "C:\Python26\Scripts\pylint", line 5, in <module>
    pkg_resources.run_script('pylint==0.24.0', 'pylint')
  File "c:\Python26\lib\site-packages\pkg_resources.py", line 489, in run_script

    self.require(requires)[0].run_script(script_name, ns)
  File "c:\Python26\lib\site-packages\pkg_resources.py", line 1207, in run_script
    execfile(script_filename, namespace, namespace)
  File "c:\python26\lib\site-packages\pylint-0.24.0-py2.6.egg\EGGINFO\scripts\pylint", line 3, in <module>
    from pylint import lint
  File "c:\Python26\lib\site-packages\pylint-0.24.0-py2.6.egg\pylint\lint.py", line 31, in <module>
    from pylint.checkers import utils
  File "c:\Python26\lib\site-packages\pylint-0.24.0py2.6.egg\pylint\checkers\__init__.py", line 44, in <module>
    from logilab.astng.utils import ASTWalker
  File "c:\Python26\lib\site-packages\logilab_astng-0.22.0py2.6.egg\logilab\astng\__init__.py", line 58, in <module>
    from logilab.astng.nodes import *
  File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\nodes.py", line 54, in <module>
    from logilab.astng.node_classes import Arguments, AssAttr, Assert, Assign, \

  File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\node_classes.py", line 27, in <module>
    from logilab.astng.bases import (NodeNG, Statement, Instance, InferenceContext,
  File "c:\Python26\lib\site-packages\logilab_astng-0.22.0-py2.6.egg\logilab\astng\bases.py", line 28, in <module>
    from logilab.common.compat import builtins
ImportError: cannot import name builtins

I mucked around and looked into based.py, but I have no clue what the problem is. My shell path includes C:\python26;c:\Python26\Scripts.

Does this have something to do with lib2to3? Or Python 2.6 compatibility?

Note that I installed pylint using "easy_install pylint", and logilab-common is at the latest 0.56.2.

Thanks!

Upvotes: 0

Views: 3698

Answers (2)

codewarrior
codewarrior

Reputation: 2030

For me, there is a logilab.common.compat module buried inside the egg "logilab.pylintinstaller-0.15.2-py2.6.egg" in my site-packages folder. Having the logilab_common egg installed, removing the pylintinstaller egg got pylint working in eclipse. I found this out via IPython like so:

In [37]: import logilab.common.compat

In [38]: from logilab.common.compat import builtins
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

C:\Users\Rio\Documents\mcedit\pymclevel\<ipython console> in <module>()

ImportError: cannot import name builtins

In [41]: logilab.common.compat.__file__
Out[41]: 'c:\\python26\\lib\\site-packages\\logilab.pylintinstaller-0.15.2-py2.6.egg\\logilab\\common\\compat.pyc'

Upvotes: 1

fabmilo
fabmilo

Reputation: 48330

Probably you don't have the logilab.common package or the installed version is an old one.

try:

easy_install-2.6 --upgrade logilab-common

Upvotes: 0

Related Questions