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

Suspicious state from syntax checker python-pylint/astroid.exceptions.TooManyLevelsError: Relative import with too many levels (1) for module 'flycheck_AUtils' #1899

Closed
5 of 7 tasks
qohelet opened this issue Aug 23, 2021 · 4 comments

Comments

@qohelet
Copy link

qohelet commented Aug 23, 2021

Checklist

  • I have checked existing issues for potential duplicates before creating this one.
  • I have read the [Troubleshooting guide][https://www.flycheck.org/en/latest/user/troubleshooting.html].

Bug description

When editing a file the messages-buffer constantly shows up and gives me the following message:

Suspicious state from syntax checker python-pylint: Flycheck checker python-pylint returned 1, but its output contained no errors: Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.9/runpy.py", line 213, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.9/site-packages/pylint/__main__.py", line 9, in <module>
    pylint.run_pylint()
  File "/usr/lib/python3.9/site-packages/pylint/__init__.py", line 24, in run_pylint
    PylintRun(sys.argv[1:])
  File "/usr/lib/python3.9/site-packages/pylint/lint/run.py", line 384, in __init__
    linter.check(args)
  File "/usr/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 975, in check
    self._check_files(
  File "/usr/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1009, in _check_files
    self._check_file(get_ast, check_astroid_module, name, filepath, modname)
  File "/usr/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1035, in _check_file
    check_astroid_module(ast_node)
  File "/usr/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1172, in check_astroid_module
    retval = self._check_astroid_module(
  File "/usr/lib/python3.9/site-packages/pylint/lint/pylinter.py", line 1217, in _check_astroid_module
    walker.walk(ast_node)
  File "/usr/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 77, in walk
    self.walk(child)
  File "/usr/lib/python3.9/site-packages/pylint/utils/ast_walker.py", line 74, in walk
    callback(astroid)
  File "/usr/lib/python3.9/site-packages/pylint/checkers/deprecated.py", line 112, in visit_importfrom
    basename = get_import_name(node, basename)
  File "/usr/lib/python3.9/site-packages/pylint/checkers/utils.py", line 1552, in get_import_name
    modname = root.relative_to_absolute_name(
  File "/usr/lib/python3.9/site-packages/astroid/scoped_nodes.py", line 726, in relative_to_absolute_name
    raise TooManyLevelsError(level=level, name=self.name)
astroid.exceptions.TooManyLevelsError: Relative import with too many levels (1) for module 'flycheck_AUtils'
Exception on node <ImportFrom l.15 at 0x7f5ce4f46a30> in file '/home/qohelet/MOP/pyara/flycheck_AUtils.py'
Try installing a more recent version of python-pylint, and please open a bug report if the issue persists in the latest release.  Thanks!

All the packages have been upgraded. I googled the error but couldn't find anything related. Also I can't figure out which one is the problem. Is it flycheck or pylint?

Steps to reproduce

Steps to reproduce the behavior:

  1. Open any Python-File
  2. Do Edits, Save, keep on Editing
  3. A wild message appears

Expected behavior

Either a clearer description of what's the exact problem or a persistent message, but not a pop-up

Screenshots

Just the errorlog, looks the same in emacs

System configuration

Syntax checkers for buffer AUtils.py in python-mode:
First checker to run:
  python-flake8
    - may enable:         yes
    - executable:         Found at /usr/bin/python3
    - configuration file: Not found
    - `flake8' module:    Found at "/home/qohelet/.local/lib/python3.9/site-packages/flake8/__init__.py"
    - next checkers:      python-pylint, python-mypy
Checkers that may run as part of the first checker's chain:
  python-pylint
    - may enable:         yes
    - executable:         Found at /usr/bin/python3
    - configuration file: Not found
    - `pylint' module:    Found at "/usr/lib/python3.9/site-packages/pylint/__init__.py"
    - next checkers:      python-mypy
Checkers that could run if selected:
  python-pycompile  select
    - may enable:    yes
    - executable:    Found at /usr/bin/python3
    - next checkers: python-mypy
Checkers that are compatible with this mode, but will not run until properly configured:
  python-pyright (automatically disabled) reset
    - may enable: no
    - executable: Not found
  python-mypy (automatically disabled) reset
    - may enable:         no
    - may run:            t
    - executable:         Not found
    - configuration file: Not found
Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.
--------------------
Flycheck version: 32snapshot (package: 20210708.1337)
Emacs version:    27.2
System:           x86_64-redhat-linux-gnu
Window system:    x

Emacs configuration:

Additional notes

Problem appeared today - and for the first time, I couldn't figure out yet what caused it.
Restarted emacs after the upgrades. Can't find the issue by myself

@cpitclaudel
Copy link
Member

Ouch, sorry for the trouble. It looks like a pylint bug: this message is produced by pylint, and Flycheck is complaining that it doesn't understand it, because it doesn't follow the usual format for Pylint errors.

You can use C-c ! C-c to run pylint as a command line program. This should reproduce the error; please submit it to the pylint folks and add a link back here.

I'll close this issue since the problem is on the pylint side.

@qohelet
Copy link
Author

qohelet commented Aug 24, 2021

Thank you for your quick answer. Running
pylint
just returns
[No match]
I assume this is due to the amount of pylint-packages. Any idea which one it could be or how to find it out?

@cpitclaudel
Copy link
Member

Are you using C-c ! C-c to run pylint? That will show you the exact command that Flycheck is using.

@qohelet
Copy link
Author

qohelet commented Aug 24, 2021

Are you using C-c ! C-c to run pylint?

I had to executpylint-python as there are various pylint-packages.

The result is pretty long and lists every warning it can find, so it's cropped to the more relevant parts:

-*- mode: compilation; default-directory: "~/MOP/pytesting/Testing/" -*-
Compilation started at Tue Aug 24 16:18:31

/usr/bin/python3 -c import\ sys\;sys.path.pop\(0\)\;import\ runpy\;runpy.run_module\(\"pylint\"\) --reports\=n --output-format\=json /home/qohelet/MOP/pytesting/Testing/AUTests.py
[
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 37,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "line-too-long",
        "message": "Line too long (136/100)",
        "message-id": "C0301"
    },
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 154,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "line-too-long",
        "message": "Line too long (131/100)",
        "message-id": "C0301"
    },
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 195,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "line-too-long",
        "message": "Line too long (122/100)",
        "message-id": "C0301"
    },
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "invalid-name",
        "message": "Module name \"AUTests\" doesn't conform to snake_case naming style",
        "message-id": "C0103"
    },
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "missing-module-docstring",
        "message": "Missing module docstring",
        "message-id": "C0114"
    },
.... And so on and so forth...
    {
        "type": "convention",
        "module": "AUTests",
        "obj": "",
        "line": 20,
        "column": 0,
        "path": "AUTests.py",
        "symbol": "ungrouped-imports",
        "message": "Imports from package pyara are not grouped",
        "message-id": "C0412"
    }
]

Compilation exited abnormally with code 30 at Tue Aug 24 16:18:37

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

No branches or pull requests

2 participants