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

[Backport maintenance/2.15.x] Fix ModuleNotFoundError when using pylint_django #7941

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7938.bugfix
@@ -0,0 +1,3 @@
Fixes a ``ModuleNotFound`` exception when running pylint on a Django project with the ``pylint_django`` plugin enabled.

Closes #7938
4 changes: 2 additions & 2 deletions pylint/lint/pylinter.py
Expand Up @@ -690,8 +690,8 @@ def check(self, files_or_modules: Sequence[str] | str) -> None:
data = None

# The contextmanager also opens all checkers and sets up the PyLinter class
with self._astroid_module_checker() as check_astroid_module:
with fix_import_path(files_or_modules):
with fix_import_path(files_or_modules):
with self._astroid_module_checker() as check_astroid_module:
# 4) Get the AST for each FileItem
ast_per_fileitem = self._get_asts(fileitems, data)

Expand Down