You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Sublime Text editor, install Anaconda package, install pylint and astroid with pip3
Write code with relative imports, like ("from .my_submodule import stuff")
Open the file with ST3
Current behavior
When I open sublime text editor with a python code with relative import, I see the following traceback from linter:
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "/usr/local/lib/python3.9/dist-packages/pylint/__init__.py", line 24, in run_pylint
PylintRun(sys.argv[1:])
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/run.py", line 384, in __init__
linter.check(args)
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/pylinter.py", line 975, in check
self._check_files(
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/pylinter.py", line 1009, in _check_files
self._check_file(get_ast, check_astroid_module, name, filepath, modname)
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/pylinter.py", line 1035, in _check_file
check_astroid_module(ast_node)
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/pylinter.py", line 1172, in check_astroid_module
retval = self._check_astroid_module(
File "/usr/local/lib/python3.9/dist-packages/pylint/lint/pylinter.py", line 1217, in _check_astroid_module
walker.walk(ast_node)
File "/usr/local/lib/python3.9/dist-packages/pylint/utils/ast_walker.py", line 77, in walk
self.walk(child)
File "/usr/local/lib/python3.9/dist-packages/pylint/utils/ast_walker.py", line 74, in walk
callback(astroid)
File "/usr/local/lib/python3.9/dist-packages/pylint/checkers/deprecated.py", line 112, in visit_importfrom
basename = get_import_name(node, basename)
File "/usr/local/lib/python3.9/dist-packages/pylint/checkers/utils.py", line 1552, in get_import_name
modname = root.relative_to_absolute_name(
File "/usr/local/lib/python3.9/dist-packages/astroid/scoped_nodes.py", line 725, in relative_to_absolute_name
raise TooManyLevelsError(level=level, name=self.name)
astroid.exceptions.TooManyLevelsError: Relative import with too many levels (1) for module 'rating'
Notes
If I manually change file: /usr/local/lib/python3.9/dist-packages/astroid/scoped_nodes.py from this:
Reproduce
Current behavior
When I open sublime text editor with a python code with relative import, I see the following traceback from linter:
Notes
If I manually change file:
/usr/local/lib/python3.9/dist-packages/astroid/scoped_nodes.py
from this:to this:
Than everything goes fine, but linter says:
Unable to import '<cur_file>.<module>' (import-error)
But should be: `<top_level_dir_name>.
python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
outputThanks.
The text was updated successfully, but these errors were encountered: