New submission from Chris Jerdonek <chris.jerdo...@gmail.com>: The pkgutil.ImpImporter documentation says that if dirname is None, ImpImporter(dirname) should create a PEP 302 importer that searches the current sys.path, plus any modules that are frozen or built-in:
http://docs.python.org/dev/library/pkgutil.html#pkgutil.ImpImporter However, the iter_modules() method of an ImpImporter instance doesn't search sys.path if dirname is None. It returns a generator that always yields nothing. For example-- Python 3.3.0b1 (default:5d43154d68a8, Jul 8 2012, 13:54:45) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin >>> from pkgutil import ImpImporter >>> importer = ImpImporter() >>> list(importer.iter_modules()) [] Strictly speaking, one could say the documentation only applies to the find_module() method since that's the only method covered by the PEP 302 API However, iter_modules() is a public method. So I think that either iter_modules() should be fixed, made private, or else the documentation clarified by saying that searching sys.path does not apply to iter_modules(). I'm pretty sure though that iter_modules() should be fixed. This is because there are other functions in pkgutil that seem not to work because ImpImporter.iter_modules() behaves the way it does (specifically calling pkgutil.iter_modules() with path=None). ---------- components: Library (Lib) messages: 165038 nosy: cjerdonek priority: normal severity: normal status: open title: ImpImporter(None).iter_modules() does not search sys.path versions: Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15299> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com