pylint etc. for python 3

2011-07-27
2013-03-15
  • atthecorner

    atthecorner - 2011-07-27

    All this pylint activity has me  looking for pylint ( and dependent packages) that can lint python 3 code. My reading of the logilab.org and activestate site pages suggested to me that pylint release 0.22.0, or 0.24.0 would support.it.  The setup.py scripts fail in a way that suggest they are python 2.7 code. 

    I figure folks here might know definitively.  I guess the question is: Does a a pylint package anywhere exist for Windows and python 3.2. 

    thanks,
    -m

     
  • Piotr Dobrogost

    Piotr Dobrogost - 2011-07-27

    I tried installing pylint 0.24.0 on Python 3.2.1 and got this:

      Running setup.py egg_info for package unittest2
        Traceback (most recent call last):
          File "<string>", line 14, in <module>
          File "c:\python\virtualenv\pylint-py3.2\build\unittest2\setup.py", line 12, in <module>
            from unittest2 import __version__ as VERSION
          File "unittest2\__init__.py", line 40, in <module>
            from unittest2.collector import collector
          File "unittest2\collector.py", line 3, in <module>
            from unittest2.loader import defaultTestLoader
          File "unittest2\loader.py", line 92
            except Exception, e:

     
  • Piotr Dobrogost

    Piotr Dobrogost - 2011-07-27

    Although there is a version of unittest2 for Python 3 (http://pypi.python.org/pypi/unittest2py3k) I think logilab-common (needed by pylint) should use std unittest from Python 3 (which unittest2 is a backport of).

     
  • atthecorner

    atthecorner - 2011-07-27

    re: unittest instead of unittest2. I agree.

    While completing a pylint windows port seemed to be a suggestion for the google summer of code. I could not see that anyone signed up for it.

    Logilab reports that a pylint 0.24.0 works on linux. I will pursue that. I need to port periodically anyway. We'll see.

     
  • atthecorner

    atthecorner - 2011-07-28

    Your error is different from mine. My pylint 0.24.0 error trace follows.

    First error is:                                                                  LookupError: unknown encoding: IBO-8859-1
    Which perhaps provokes the second error:            SyntaxError: unknown encoding: IBO-8859-1

    Then again perhaps not.

    ….  Initial lines deleted  …

    Skipping implicit fixer: buffer
    Skipping implicit fixer: idioms
    Skipping implicit fixer: set_literal
    Skipping implicit fixer: ws_comma
    Can't parse build\lib\pylint\test\input\func_syntax_error.py: ParseError: bad input: type=4, value='\n', context=('', (1, 8))
    Traceback (most recent call last):
      File "C:\opt\Python-3.2\lib\lib2to3\pgen2\tokenize.py", line 290, in find_cookie
        codec = lookup(encoding)
    LookupError: unknown encoding: IBO-8859-1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "setup.py", line 187, in <module>
        install()
      File "setup.py", line 183, in install
        **kwargs
      File "C:\opt\Python-3.2\lib\distutils\core.py", line 149, in setup
        dist.run_commands()
      File "C:\opt\Python-3.2\lib\distutils\dist.py", line 919, in run_commands
        self.run_command(cmd)
      File "C:\opt\Python-3.2\lib\distutils\dist.py", line 938, in run_command
        cmd_obj.run()
      File "C:\opt\Python-3.2\lib\distutils\command\install.py", line 571, in run
        self.run_command('build')
      File "C:\opt\Python-3.2\lib\distutils\cmd.py", line 315, in run_command
        self.distribution.run_command(command)
      File "C:\opt\Python-3.2\lib\distutils\dist.py", line 938, in run_command
        cmd_obj.run()
      File "C:\opt\Python-3.2\lib\distutils\command\build.py", line 128, in run
        self.run_command(cmd_name)
      File "C:\opt\Python-3.2\lib\distutils\cmd.py", line 315, in run_command
        self.distribution.run_command(command)
      File "C:\opt\Python-3.2\lib\distutils\dist.py", line 938, in run_command
        cmd_obj.run()
      File "setup.py", line 59, in run
        self.run_2to3(self.updated_files)
      File "C:\opt\Python-3.2\lib\distutils\util.py", line 645, in run_2to3
        return run_2to3(files, self.fixer_names, self.options, self.explicit)
      File "C:\opt\Python-3.2\lib\distutils\util.py", line 593, in run_2to3
        r.refactor(files, write=True)
      File "C:\opt\Python-3.2\lib\lib2to3\refactor.py", line 296, in refactor
        self.refactor_file(dir_or_file, write, doctests_only)
      File "C:\opt\Python-3.2\lib\lib2to3\refactor.py", line 336, in refactor_file
        input, encoding = self._read_python_source(filename)
      File "C:\opt\Python-3.2\lib\lib2to3\refactor.py", line 328, in _read_python_source
        encoding = tokenize.detect_encoding(f.readline)
      File "C:\opt\Python-3.2\lib\lib2to3\pgen2\tokenize.py", line 310, in detect_encoding
        encoding = find_cookie(first)
      File "C:\opt\Python-3.2\lib\lib2to3\pgen2\tokenize.py", line 293, in find_cookie
        raise SyntaxError("unknown encoding: " + encoding)
    SyntaxError: unknown encoding: IBO-8859-1