[issue14982] pkgutil.walk_packages seems to not work properly on Python 3.3a

Chris Jerdonek report at bugs.python.org
Sat Jul 7 17:45:06 CEST 2012


Chris Jerdonek <chris.jerdonek at gmail.com> added the comment:

As someone who isn't an expert on Python's import mechanisms, I'm confused by this comment at the end of pkgutil.walk_packages():

"Note: Only works for importers which define a iter_modules() method, which is non-standard but implemented by classes defined in this module."

I'm confused because importers aren't mentioned anywhere in the context of walk_packages() (in particular, `importer` is not a parameter to the function), so it's not clear to me how the note comes into play.

For example, is "importers" in reference to the import statements inside the modules in the package that one is trying to walk, or is it a reference to whether or not the user has overridden Python's standard import with a custom import function?

In particular, does this mean that the normal case of trying to walk a directory using `pkgutil.walk_packages(['my_dir'])` won't work without doing something special, and if so, can that special thing be added?

I think it would help if this were made clearer.  I came to this after trying to start working on issue 14787.

----------

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


More information about the Python-bugs-list mailing list