[issue21052] Consider dropping ImportWarning for empty sys.path_hooks and sys.meta_path

Masami HIRATA report at bugs.python.org
Sun Jul 6 15:14:32 CEST 2014


Masami HIRATA added the comment:

Hi,

I can reproduce this issue with the following steps.

$ uname -a
Linux ashrose 3.2.0-65-generic #99-Ubuntu SMP Fri Jul 4 21:03:29 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ python3.4 --version
Python 3.4.1
$ touch spam.txt
$ python3.4 -Wa -c "class A: pass; a = open('spam.txt')"
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='spam.txt' mode='r' encoding='UTF-8'>
_frozen_importlib:2150: ImportWarning: sys.meta_path is empty
_frozen_importlib:2150: ImportWarning: sys.meta_path is empty
_frozen_importlib:2150: ImportWarning: sys.meta_path is empty
_frozen_importlib:2150: ImportWarning: sys.meta_path is empty
_frozen_importlib:2150: ImportWarning: sys.meta_path is empty
...
$ python3.4 -Wa -c "a = open('spam.txt')"
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='spam.txt' mode='r' encoding='UTF-8'>
$ python3.4 -Wa -c "class A: pass; open('spam.txt')"
-c:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='spam.txt' mode='r' encoding='UTF-8'>
$

----------
nosy: +msmhrt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21052>
_______________________________________


More information about the Python-bugs-list mailing list