[issue14710] pkgutil.get_loader is broken
Pavel Aslanov
report at bugs.python.org
Mon May 19 13:14:37 CEST 2014
Pavel Aslanov added the comment:
This function is broken again in version 3.4
The way it should look is:
Python 2.7.6 (default, Feb 26 2014, 12:07:17)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkgutil
>>> pkgutil.get_loader('no_such_module') # returns None
>>>
How it really looks:
Python 3.4.0 (default, Apr 27 2014, 23:33:09)
[GCC 4.8.2 20140206 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkgutil
>>> pkgutil.get_loader('no_such_module')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/pkgutil.py", line 467, in get_loader
return find_loader(fullname)
File "/usr/lib/python3.4/pkgutil.py", line 488, in find_loader
return spec.loader
AttributeError: 'NoneType' object has no attribute 'loader'
>>>
find_loader is at fault (change "return spec.loader" -> "return spec and spec.loader"). Thanks.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14710>
_______________________________________
More information about the Python-bugs-list
mailing list