From 20be4f02c88100c08c571addd40b31dcea4b8e4e Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 27 Jul 2020 11:28:05 -0700 Subject: [PATCH] Turn print into warning to simplify silencing them. --- jedi/inference/compiled/access.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jedi/inference/compiled/access.py b/jedi/inference/compiled/access.py index 29f5ced1..299e3f03 100644 --- a/jedi/inference/compiled/access.py +++ b/jedi/inference/compiled/access.py @@ -117,13 +117,13 @@ def load_module(inference_state, dotted_name, sys_path): __import__(dotted_name) except ImportError: # If a module is "corrupt" or not really a Python module or whatever. - print('Module %s not importable in path %s.' % (dotted_name, sys_path), file=sys.stderr) + warnings.warn('Module %s not importable in path %s.' % (dotted_name, sys_path), UserWarning) return None except Exception: # Since __import__ pretty much makes code execution possible, just # catch any error here and print it. import traceback - print("Cannot import:\n%s" % traceback.format_exc(), file=sys.stderr) + warnings.warn("Cannot import:\n%s" % traceback.format_exc(), UserWarning) return None finally: sys.path = temp