Saturday, December 13, 2014

Pylint Broken on install: "control_pragmas = {'disable', 'enable'}"

So, wanting better Python code and having used pychecker for years and years, I was recently pointed to pylint again as a tool-of-choice.

Installing it was simple:

$ sudo pip install pylint
Downloading/unpacking pylint
Downloading pylint-1.4.0-py2.py3-none-any.whl (412kB): 412kB downloaded
Downloading/unpacking astroid>=1.3.2 (from pylint)
Downloading astroid-1.3.2-py2.py3-none-any.whl (163kB): 163kB downloaded
Downloading/unpacking six (from pylint)
Downloading six-1.8.0-py2.py3-none-any.whl
Downloading/unpacking logilab-common>=0.53.0 (from pylint)
Downloading logilab-common-0.63.2.tar.gz (196kB): 196kB downloaded
Running setup.py (path:/tmp/pip_build_root/logilab-common/setup.py) egg_info for package logilab-common
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_require'
warnings.warn(msg)
package init file './test/__init__.py' not found (or not a regular file)
Downloading/unpacking unittest2>=0.5.1 (from logilab-common>=0.53.0->pylint)
Downloading unittest2-0.8.0-py2.py3-none-any.whl (94kB): 94kB downloaded
Downloading/unpacking argparse (from unittest2>=0.5.1->logilab-common>=0.53.0->pylint)
Downloading argparse-1.2.2-py2.py3-none-any.whl
Installing collected packages: pylint, astroid, six, logilab-common, unittest2, argparse
Compiling /tmp/pip_build_root/pylint/pylint/lint.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/lint.py', 585, 37, " control_pragmas = {'disable', 'enable'}\n"))

Compiling /tmp/pip_build_root/pylint/pylint/reporters/text.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/reporters/text.py', 136, 18, " for attr in ('msg', 'symbol', 'category', 'C')})\n"))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/abstract_abc_methods.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/abstract_abc_methods.py', 6, 31, 'class Parent(object, metaclass=abc.ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/abstract_class_instantiated_py2.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/abstract_class_instantiated_py2.py', 15, 34, 'class GoodClass(object, metaclass=abc.ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/abstract_class_instantiated_py3.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/abstract_class_instantiated_py3.py', 14, 34, 'class GoodClass(object, metaclass=abc.ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/class_members_py27.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/class_members_py27.py', 34, 38, 'class TestMetaclass(object, metaclass=ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/class_members_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/class_members_py30.py', 34, 38, 'class TestMetaclass(object, metaclass=ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/defined_and_used_on_same_line.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/defined_and_used_on_same_line.py', 29, 20, "with open('f') as f, open(f.read()) as g:\n"))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/no_name_in_module.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/no_name_in_module.py', 15, 26, "print('hello world', file=sys.stdout)\n"))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/old_style_class_py27.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/old_style_class_py27.py', 10, 29, 'class NotOldStyle2(metaclass=type):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/unbalanced_tuple_unpacking_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/unbalanced_tuple_unpacking_py30.py', 9, 20, ' first, second, *last = (1, 2, 3, 4)\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/undefined_variable_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/functional/undefined_variable_py30.py', 8, 19, ' def test(self)->Undefined: # [undefined-variable]\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/functional/yield_outside_func.py ...
SyntaxError: ("'yield' outside function", ('/tmp/pip_build_root/pylint/pylint/test/functional/yield_outside_func.py', 2, None, 'yield 1 # [yield-outside-function]\n'))

/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:4: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2), "no error"
/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:5: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2) #this should generate a warning
/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:7: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, ), "no error"
/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:8: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, )
/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:9: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2, 3 == 5), "no error"
/tmp/pip_build_root/pylint/pylint/test/input/func_assert_2uple.py:11: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (True, 'error msg') #this should generate a warning
Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_bad_cont_dictcomp_py27.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_bad_cont_dictcomp_py27.py', 8, 9, ' for x in range(3)}\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_bad_exception_context_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_bad_exception_context_py30.py', 14, 25, ' raise IndexError from 1\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_continue_not_in_loop.py ...
SyntaxError: ("'continue' not properly in loop", ('/tmp/pip_build_root/pylint/pylint/test/input/func_continue_not_in_loop.py', 8, None, 'continue\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_e0108.py ...
SyntaxError: ("duplicate argument '_' in function definition",)

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_exec_used_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_exec_used_py30.py', 6, 22, "exec('a = 1', globals={})\n"))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_keyword_repeat.py ...
SyntaxError: ('keyword argument repeated', ('/tmp/pip_build_root/pylint/pylint/test/input/func_keyword_repeat.py', 8, None, 'function_default_arg(two=5, two=7)\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_kwoa_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_kwoa_py30.py', 3, 15, 'def function(*, foo):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_loopvar_in_dict_comp_py27.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_loopvar_in_dict_comp_py27.py', 8, 28, ' return {x: lambda: x for x in range(10)}\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_noerror_mcs_attr_access.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_noerror_mcs_attr_access.py', 14, 29, 'class Test(object, metaclass=Meta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_noerror_unused_variable_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_noerror_unused_variable_py30.py', 12, 21, ' nonlocal attr\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_return_outside_func.py ...
SyntaxError: ("'return' outside function", ('/tmp/pip_build_root/pylint/pylint/test/input/func_return_outside_func.py', 3, None, 'return\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_return_yield_mix_py_33.py ...
SyntaxError: ("'return' with argument inside generator",)

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_set_literal_as_default_py27.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_set_literal_as_default_py27.py', 5, 23, 'def function1(value={1}):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_syntax_error.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_syntax_error.py', 1, 9, 'def toto\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_undefined_metaclass_var_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_undefined_metaclass_var_py30.py', 8, 20, 'class Bad(metaclass=ABCMet):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_unused_import_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_unused_import_py30.py', 10, 21, 'class Meta(metaclass=abc.ABCMeta):\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_used_before_assignment_py30.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/test/input/func_used_before_assignment_py30.py', 10, 20, ' nonlocal cnt\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/func_w0705.py ...
SyntaxError: ("default 'except:' must be last", ('/tmp/pip_build_root/pylint/pylint/test/input/func_w0705.py', 28, None, '__revision__ += 1\n'))

Compiling /tmp/pip_build_root/pylint/pylint/test/input/syntax_error.py ...
Sorry: IndentationError: ('expected an indented block', ('/tmp/pip_build_root/pylint/pylint/test/input/syntax_error.py', 2, 5, "print('hop')\n"))
Compiling /tmp/pip_build_root/pylint/pylint/utils.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/pylint/pylint/utils.py', 59, 26, 'MSG_TYPES_LONG = {v: k for k, v in six.iteritems(MSG_TYPES)}\n'))

Compiling /tmp/pip_build_root/astroid/astroid/tests/testdata/python3/data/module.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/testdata/python3/data/module.py', 55, 32, " print('yo', end=' ')\n"))

Compiling /tmp/pip_build_root/astroid/astroid/tests/testdata/python3/data/module2.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/testdata/python3/data/module2.py', 100, 22, "print('bonjour', file=stream)\n"))

Compiling /tmp/pip_build_root/astroid/astroid/tests/unittest_brain.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/unittest_brain.py', 71, 33, ' self.assertSetEqual({"a", "b", "c"}, set(base.instance_attrs))\n'))

Compiling /tmp/pip_build_root/astroid/astroid/tests/unittest_inference.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/unittest_inference.py', 492, 44, ' self.assertSetEqual({n.__class__ for n in xxx.infered()},\n'))

Compiling /tmp/pip_build_root/astroid/astroid/tests/unittest_modutils.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/unittest_modutils.py', 248, 41, " {os.path.join(package, x) for x in ['__init__.py', 'module.py', 'module2.py', 'noendingnewline.py', 'nonregr.py']})\n"))

Compiling /tmp/pip_build_root/astroid/astroid/tests/unittest_scoped_nodes.py ...
SyntaxError: ('invalid syntax', ('/tmp/pip_build_root/astroid/astroid/tests/unittest_scoped_nodes.py', 556, 39, " expected_methods = {'__init__', 'class_method', 'method', 'static_method'}\n"))

Running setup.py install for logilab-common
/usr/lib64/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_require'
warnings.warn(msg)
package init file './test/__init__.py' not found (or not a regular file)
package init file './test/__init__.py' not found (or not a regular file)
changing mode of build/scripts-2.6/pytest from 644 to 755
package init file './test/__init__.py' not found (or not a regular file)
Installing /usr/lib/python2.6/site-packages/logilab_common-0.63.2-py2.6-nspkg.pth
changing mode of /usr/bin/pytest to 755
package init file './test/__init__.py' not found (or not a regular file)
Successfully installed pylint astroid six logilab-common unittest2 argparse
Cleaning up...
krice4@graph301p:~$ dir
Thinking this would be good, I did the normal first-use invocation:

[esm@graph301p:bin]$ pylint
Traceback (most recent call last):
  File "/usr/bin/pylint", line 11, in
    sys.exit(run_pylint())
  File "/usr/lib/python2.6/site-packages/pylint/__init__.py", line 22, in run_pylint
    from pylint.lint import Run
  File "/usr/lib/python2.6/site-packages/pylint/lint.py", line 585
    control_pragmas = {'disable', 'enable'}
                                ^
SyntaxError: invalid syntax
[esm@graph301p:bin]$ dir

No joy.  Thinking my install failed, I turned to the intertubewebs and found that the Pylint people decided to not support Python 2.6 anymore.  It's apparently a Python 2.7 game only now.


I found out from here:  https://bitbucket.org/logilab/pylint/issue/390/py26-compatiblity-broken

Not to worry, though, pychecker still works.
Post a Comment