[Python-projects] astng 0.18.0 not compatible with Python 2.6?

Maarten ter Huurne maarten at treewalker.org
Sat Mar 21 14:27:44 CET 2009


On Saturday 21 March 2009, David Douard wrote:

> There is a blog entry describing the support for ast module added in this
> version :
>
> http://www.logilab.org/blogentry/8554

Thanks for the link, that's an interesting read!


I just installed pylint 0.17.0 and astng 0.18.0 and unfortunately I cannot 
get it to do anything at all. This is on Python 2.6 on SUSE Linux x86_64.

$ pylint -rn hello.py
Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 3, in <module>
    from pylint import lint
  File "/usr/local/lib64/python2.6/site-packages/pylint/lint.py", line 31, 
in <module>
    from pylint.checkers import utils
  File "/usr/local/lib64/python2.6/site-
packages/pylint/checkers/__init__.py", line 39, in <module>
    from logilab.astng.utils import ASTWalker
  File "/usr/local/lib64/python2.6/site-packages/logilab/astng/__init__.py", 
line 53, in <module>
    from logilab.astng.manager import ASTNGManager, Project, Package
  File "/usr/local/lib64/python2.6/site-packages/logilab/astng/manager.py", 
line 35, in <module>
    from logilab.astng import ASTNGBuildingException, nodes, infutils
  File "/usr/local/lib64/python2.6/site-packages/logilab/astng/nodes.py", 
line 339, in <module>
    extend_class(Node, NodeNG)
  File "/usr/local/lib64/python2.6/site-packages/logilab/astng/utils.py", 
line 40, in extend_class
    setattr(original, k, v)
TypeError: can't set attributes of built-in/extension type '_ast.AST'

The same error occurs on "from logilab import astng". It seems the Python 
2.6 version of "_ast.AST" does not allow adding attributes:

Python 2.6 (r26:66714, Feb  3 2009, 20:49:49)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _ast
>>> _ast.AST
<type '_ast.AST'>
>>> setattr(_ast.AST, 'test', 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type '_ast.AST'
>>>

Python 2.5 (release25-maint, Jul 20 2008, 20:47:25)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _ast
>>> _ast.AST
<class '_ast.AST'>
>>> setattr(_ast.AST, 'test', 1)
>>>

Note that "_ast.AST" changed from class (2.5) to type (2.6).

Bye,
		Maarten



More information about the Python-Projects mailing list