Pylint Error when using metaclass

1.3k views Asked by At

i try to fix all pylint errors and pylint warnings in a project. but i keep getting an error when i set a metaclass (https://www.python.org/dev/peps/pep-3115/).

here is my example code:

#!/usr/bin/env python3

class MyMeta(type):
    pass

class MyObject(object, metaclass=MyMeta): # pylint error here
    pass

the error just says "invalid syntax". i use pylint via the vim plugin syntastic (https://github.com/scrooloose/syntastic).

my pylint version is (pylint --version):

pylint 1.4.3, 
astroid 1.3.6, common 0.63.2
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1]

my syntastic plugin is up to date with github.

any ideas?

1

There are 1 answers

1
Padraic Cunningham On BEST ANSWER

In the docs under 4.2. Q. The python checker complains about syntactically valid Python 3 constructs...:

A. Configure the python checker to call a Python 3 interpreter rather than Python 2, e.g:

let g:syntastic_python_python_exec = '/path/to/python3'