Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'pattern' #108

Closed
rgaiacs opened this issue Dec 18, 2017 · 15 comments
Closed

AttributeError: 'NoneType' object has no attribute 'pattern' #108

rgaiacs opened this issue Dec 18, 2017 · 15 comments

Comments

@rgaiacs
Copy link

rgaiacs commented Dec 18, 2017

Travis CI is falling for me in another project because of

$ python -m pylint lowfat
Using config file /home/travis/build/softwaresaved/lowfat/pylintrc
Traceback (most recent call last):
  File "/opt/python/3.5.4/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/python/3.5.4/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/__main__.py", line 7, in <module>
    pylint.run_pylint()
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/__init__.py", line 16, in run_pylint
    Run(sys.argv[1:])
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/lint.py", line 1312, in __init__
    linter.load_plugin_modules(plugins)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/pylint/lint.py", line 495, in load_plugin_modules
    module.register(self)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/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'

Any suggestions of what can be causing it?

@asifpy
Copy link

asifpy commented Dec 18, 2017

What version of pylint are you using? I had similar issue with the latest pylint==1.8, and pylint-django doesn't seems to compatible with latest pylint.

Try to downgrade the pylint, and then test it

@rgaiacs
Copy link
Author

rgaiacs commented Dec 18, 2017

I try to downgrade pylint to a early version but I encounter other problems. Thanks for the help. Feel free to close this issue.

@christianmlong
Copy link

Downgrading to pylint 1.7.5 fixes it for me.

pip install 'pylint>=1.7,<1.8'

pylint              1.7.5
pylint-django       0.7.2
pylint-plugin-utils 0.2.6

Python 3.6.3 installed via Homebrew.

@pcharasala
Copy link

I have the same issue.
My Pylint is Pylint 1.8.1

@pcharasala
Copy link

@christianmlong Thank you somuch!
I have been struggling since morning. Finally your hint helped me.

@renatoliveira
Copy link

While downgrading to pylint 1.7.5 temporarily fixes this issue, it does present other errors (like pylint-dev/pylint#1609 which are fixed with pylint 1.8+ I believe).

I have a project that is using Django 2.0 and I've been using pylint-django with it. Some days ago I configured Travis CI and today when I added pylint to the command list I found this very issue. 😉

Build log can be found here: https://travis-ci.org/renatoliveira/notto/builds/318305203

Using:

  • Python 3.6.3 (64-bit) on Windows 10
  • Pylint 1.7.5
  • Pylint-django 0.7.2

When Pylint is upgraded to 1.8.1, I get the AttributeError mentioned by @rgaiacs as well.

@JonHerr
Copy link

JonHerr commented Dec 19, 2017

seems there was some breaking changes with setup
name_checker.config str() output for pylint versions
using pylint 1.8.1

{
    'const_rgx': None,
    'include_naming_hint': False,
    'argument_rgx': None,
    'bad_names': ('foo','bar','baz','toto','tutu','tata'),
    'good_names': ('i','j','k','ex','Run','_','qs'),
    'name_group': (),
    'argument_naming_style': 'snake_case',
    'method_rgx': None,
    'function_naming_style': 'snake_case',
    'class_rgx': None,
    'attr_rgx': None,
    'module_naming_style': 'snake_case',
    'const_naming_style': 'UPPER_CASE',
    'module_rgx': None,
    'class_naming_style': 'PascalCase',
    'class_attribute_naming_style': 'any',
    'attr_naming_style': 'snake_case',
    'inlinevar_rgx': None,
    'class_attribute_rgx': None,
    'function_rgx': None,
    'property_classes': ('abc.abstractproperty',),
    'variable_naming_style': 'snake_case',
    'variable_rgx': None,
    'method_naming_style': 'snake_case',
    'inlinevar_naming_style': 'any'
}

using pylint 1.7

{
    'inlinevar_name_hint': '[A-Za-z_][A-Za-z0-9_]*$',
    'method_name_hint': '(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$',
    'module_rgx': re.compile('(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$'),
    'attr_rgx': re.compile('(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'),
    'argument_rgx': re.compile('(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'),
    'class_name_hint': '[A-Z_][a-zA-Z0-9]+$',
    'good_names': ('i','j','k','ex','Run','_','qs'),
    'class_attribute_name_hint': '([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$',
    'class_attribute_rgx': re.compile('([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$'),
    'inlinevar_rgx': re.compile('[A-Za-z_][A-Za-z0-9_]*$'),
    'property_classes': ('abc.abstractproperty',),
    'bad_names': ('foo','bar','baz','toto','tutu','tata'),
    'class_rgx': re.compile('[A-Z_][a-zA-Z0-9]+$'),
    'variable_rgx': re.compile('(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'),
    'function_rgx': re.compile('(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'),
    'const_rgx': re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$'),
    'const_name_hint': '(([A-Z_][A-Z0-9_]*)|(__.*__))$',
    'include_naming_hint': False,
    'function_name_hint': '(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$',
    'variable_name_hint': '(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$',
    'method_rgx': re.compile('(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'),
    'attr_name_hint': '(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$',
    'module_name_hint': '(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$',
    'name_group': (),
    'argument_name_hint': '(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$'
}

nijel added a commit to WeblateOrg/website that referenced this issue Dec 20, 2017
@cristianocca
Copy link

When can we expect a fix for this? Had to update pylint and just got caught by this

@hajotka
Copy link

hajotka commented Jan 5, 2018

I'm also affected by this issue. Going back to 1.7.5 causes other issues as mentioned above.

jambonrose added a commit to jambonrose/django-improved-user that referenced this issue Jan 6, 2018
jambonrose pushed a commit to jambonrose/django-improved-user that referenced this issue Jan 6, 2018
This updates the following packages:

- faker from 0.8.7 to 0.8.8
- django-extensions from 1.9.7 to 1.9.8
- flake8-commas from 0.4.3 to 1.0.0
- flake8-quotes from 0.12.0 to 0.13.0
- setuptools from 38.2.3 to 38.4.0

To avoid a bug in pylint-django (caused by changes in the new minor
releases of pylint and astroid),  pylint and astroid versions are pinned
to the last safe versions.

pylint-dev/pylint-django#108

Finally, all versions of Django 2.0 have the alpha version removed,
creating ranges for only stable versions. Django 2.0 is used when
building documentation instead of Django 1.11.
@wli
Copy link

wli commented Jan 11, 2018

if anyone else is struggling with this, jambonrose pointed me in the right direction with his commit (jambonrose/django-improved-user@4efdea7)

  • Upgrade to pylint==1.8.1 causes AttributeError: 'NoneType' object has no attribute 'pattern'.
  • Upgraded astroid==1.6.0 causes the Unused variable '__class__' (unused-variable) error.

You'll need to pin/downgrade both to have a working environment:

astroid==1.5.3
pylint==1.7.5

atodorov pushed a commit to MrSenko/django-pylint that referenced this issue Jan 17, 2018
atodorov pushed a commit to MrSenko/django-pylint that referenced this issue Jan 17, 2018
atodorov pushed a commit to MrSenko/django-pylint that referenced this issue Jan 18, 2018
atodorov pushed a commit to MrSenko/django-pylint that referenced this issue Jan 18, 2018
atodorov pushed a commit to MrSenko/django-pylint that referenced this issue Jan 18, 2018
@hajotka
Copy link

hajotka commented Jan 19, 2018

@atodorov : Awesome! Any idea when the next release will come?

@atodorov
Copy link
Contributor

@hajotka very soon. Maybe even today.

@ecstaticpeon
Copy link

@atodorov Hello, the issue seem to have come back in 0.11 with Pylint 1.8.4 or even 1.8.2. Version 0.10.1 is fine.

@atodorov
Copy link
Contributor

@ecstaticpeon open a new issue for that with the code that reproduces it.

@ecstaticpeon
Copy link

@atodorov Actually it looks like it was something else in my environment. Sorry for the false alarm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests