summaryrefslogtreecommitdiff
path: root/pylint/utils
diff options
context:
space:
mode:
authorYilei "Dolee" Yang <yileiyang@google.com>2022-05-12 16:35:54 -0700
committerGitHub <noreply@github.com>2022-05-12 19:35:54 -0400
commit2ea65b12176e575748db64d740ef834cba577d70 (patch)
treee9888617e1715360655e250e8c267883bf5dd735 /pylint/utils
parentd668f641ef5d5794f912cd5a23292bf493290905 (diff)
downloadpylint-git-2ea65b12176e575748db64d740ef834cba577d70.tar.gz
Write the exception message to stderr in `ASTWalker.walk` (#6598)
Diffstat (limited to 'pylint/utils')
-rw-r--r--pylint/utils/ast_walker.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pylint/utils/ast_walker.py b/pylint/utils/ast_walker.py
index dae878c2d..cc387d860 100644
--- a/pylint/utils/ast_walker.py
+++ b/pylint/utils/ast_walker.py
@@ -4,6 +4,7 @@
from __future__ import annotations
+import sys
import traceback
from collections import defaultdict
from collections.abc import Sequence
@@ -95,7 +96,10 @@ class ASTWalker:
except Exception:
if self.exception_msg is False:
file = getattr(astroid.root(), "file", None)
- print(f"Exception on node {repr(astroid)} in file '{file}'")
+ print(
+ f"Exception on node {repr(astroid)} in file '{file}'",
+ file=sys.stderr,
+ )
traceback.print_exc()
self.exception_msg = True
raise