In Python3.3, I thought that every loaded module has a __loader__ attribute. Apparently this is not the case for a few builtin modules: Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import importlib >>> >>> def bug(): ... for name in list(sys.modules.keys()): ... try: ... importlib.find_loader(name) ... except Exception as details: ... print(name, type(details), details) ... >>> bug() _frozen_importlib <class 'AttributeError'> 'module' object has no attribute '__loader__' builtins <class 'AttributeError'> 'module' object has no attribute '__loader__' signal <class 'AttributeError'> 'module' object has no attribute '__loader__' importlib._bootstrap <class 'AttributeError'> 'module' object has no attribute '__loader__' >>> However, the importlib docs talk about a ValueError instead of the AttributeError that I see above: > Find the loader for a module, optionally within the specified path. > If the module is in sys.modules, then sys.modules[name].__loader__ > is returned (unless the loader would be None, in which case > ValueError is raised). Is this a bug? Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4