pylint-dev / pylint-plugin-utils

Utilities and helpers for writing Pylint plugins
GNU General Public License v2.0
24 stars 12 forks source link

ImportError: cannot import name 'UnknownMessageError' #15

Closed miphreal closed 5 years ago

miphreal commented 5 years ago

Hello, seems the new pylint-2.4.0 release is not compatible with the latest version of pylint-plugin-utils.

I started seeing the following error:

File "xxx/.pyenv/versions/3.6.9/lib/python3.6/site-packages/pylint_django/__init__.py", line 6, in <module>
from pylint_django import plugin
File "xxx/.pyenv/versions/3.6.9/lib/python3.6/site-packages/pylint_django/plugin.py", line 3, in <module>
from pylint_plugin_utils import get_checker
File "xxx/.pyenv/versions/3.6.9/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 5, in <module>
from pylint.utils import UnknownMessageError as UnknownMessage
ImportError: cannot import name 'UnknownMessageError'

It happened after pylint.utils was split into a package (so, no longer contains a reference to UnknownMessageError exception): The diff between 2.3.1 and 2.4.0 - https://github.com/PyCQA/pylint/compare/4612b66..fce8bff

bittner commented 5 years ago

The same problem persists with Pylint 2.4.1, which is pulled for pylint-django. I'm running this with Tox.

The relevant dependencies are:

pylint installed: astroid==2.3.0,Django==2.2.4,django-environ==0.4.5,django-probes==1.2.0,isort==4.3.21,lazy-object-proxy==1.4.2,mccabe==0.6.1,psycopg2==2.8.3,pylint==2.4.1,pylint-django==2.0.11,pylint-plugin-utils==0.5,pytz==2019.2,six==1.12.0,sqlparse==0.3.0,typed-ast==
1.2.0,uWSGI==2.0.18,wrapt==1.11.2
pylint run-test-pre: PYTHONHASHSEED='1965459844'
pylint runtests: commands[0] | pylint --rcfile tox.ini application
Traceback (most recent call last):
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 3, in <module>
    from pylint.utils import UnknownMessage
ImportError: cannot import name 'UnknownMessage'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/.../project/.tox/pylint/bin/pylint", line 10, in <module>
    sys.exit(run_pylint())
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint/__init__.py", line 20, in run_pylint
    Run(sys.argv[1:])
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint/lint.py", line 1686, in __init__
    linter.load_plugin_modules(plugins)
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint/lint.py", line 660, in load_plugin_modules
    module = modutils.load_module_from_name(modname)
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/astroid/modutils.py", line 198, in load_module_from_name
    return load_module_from_modpath(dotted_name.split("."), path, use_sys)
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/astroid/modutils.py", line 241, in load_module_from_modpath
    module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
  File "/home/.../project/.tox/pylint/lib/python3.6/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/home/.../project/.tox/pylint/lib/python3.6/imp.py", line 217, in load_package
    return _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint_django/__init__.py", line 6, in <module>
    from pylint_django import plugin
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint_django/plugin.py", line 3, in <module>
    from pylint_plugin_utils import get_checker
  File "/home/.../project/.tox/pylint/lib/python3.6/site-packages/pylint_plugin_utils/__init__.py", line 5, in <module>
    from pylint.utils import UnknownMessageError as UnknownMessage
ImportError: cannot import name 'UnknownMessageError'