[issue21049] Flood of “ImportWarning: sys.meta_path is empty” after exception with socket subclass
Antoine Pitrou
report at bugs.python.org
Mon Mar 24 17:44:11 CET 2014
Antoine Pitrou added the comment:
Well, basically some sys attributes (including meta_path) are cleaned during shutdown, so if some code executes afterwards and tries to import something, importlib will complain that meta_path is empty.
Unless the warning is genuinely useful, I would suggest simply removing it.
Printing warnings during import can also degenerate into an infinite recursion, if printing the warning needs to import a module, for example:
./python -Wa -c "import sys; sys.meta_path = None; import logging"
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21049>
_______________________________________
More information about the Python-bugs-list
mailing list