mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Turn print into warning to simplify silencing them.
This commit is contained in:
@@ -117,13 +117,13 @@ def load_module(inference_state, dotted_name, sys_path):
|
|||||||
__import__(dotted_name)
|
__import__(dotted_name)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# If a module is "corrupt" or not really a Python module or whatever.
|
# 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
|
return None
|
||||||
except Exception:
|
except Exception:
|
||||||
# Since __import__ pretty much makes code execution possible, just
|
# Since __import__ pretty much makes code execution possible, just
|
||||||
# catch any error here and print it.
|
# catch any error here and print it.
|
||||||
import traceback
|
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
|
return None
|
||||||
finally:
|
finally:
|
||||||
sys.path = temp
|
sys.path = temp
|
||||||
|
|||||||
Reference in New Issue
Block a user