Michael
Michael

Reputation: 73

pylint_django throwing exception

I am using Python v3.6, Django v2.0 and am having a problem with pylint_django.

Firstly, if I run "pylint polls/" to run it on a folder it runs fine and show all the code issues for all the files in the folder. There are a bunch of linting errors that falsely show due to the django framework, and I have been informed that using the pylint_django plugin will get rid of these.

I have installed the plugin using "pip install pylint_django", but when I try and run pylint using this plugin, it errors:

C:\Users\Michael\Dev\DjangoProject>pylint --load-plugins pylint_django polls/
Traceback (most recent call last):
  File "c:\users\michael\appdata\local\programs\python\python36-32\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\michael\appdata\local\programs\python\python36-32\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Michael\Envs\Django\Scripts\pylint.exe\__main__.py", line 9, in <module>
  File "c:\users\michael\envs\django\lib\site-packages\pylint\__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "c:\users\michael\envs\django\lib\site-packages\pylint\lint.py", line 1268, in __init__
    linter.load_plugin_modules(self._plugins)
  File "c:\users\michael\envs\django\lib\site-packages\pylint\lint.py", line 495, in load_plugin_modules
    module.register(self)
  File "c:\users\michael\envs\django\lib\site-packages\pylint_django\plugin.py", line 22, in register
    start = name_checker.config.const_rgx.pattern[:-2]
AttributeError: 'NoneType' object has no attribute 'pattern'

Anyone know what I might be doing wrong?

Thanks

Upvotes: 2

Views: 300

Answers (1)

Adam Pajkert
Adam Pajkert

Reputation: 56

It seems that pylint>=1.8 doesn't like pylint_django==0.7.2, try downgrading it using pip install 'pylint>=1.7,<1.8'.

Upvotes: 4

Related Questions