This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients chris.jerdonek
Date 2012-05-12.09:01:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336813271.29.0.464157696844.issue14787@psf.upfronthosting.co.za>
In-reply-to
Content
pkgutil.walk_packages(paths) seems to return incorrect results when the name of a subpackage of a path in paths matches the name of a package in the standard library.  It both excludes modules it should include, and includes modules it should exclude.  Here is an example:

> mkdir temp
> touch temp/__init__.py
> touch temp/foo.py
> mkdir temp/logging
> touch temp/logging/__init__.py
> touch temp/logging/bar.py
> python
Python 3.2.3 (default, Apr 29 2012, 01:19:06) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from pkgutil import walk_packages
>>> for info in walk_packages(['temp']):
...   print(info[1], info[0].path)
... 
foo temp
logging temp
logging.config /opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/logging
logging.handlers /opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/logging
>>> 

Observe that logging.bar is absent from the list, and logging.config and  logging.handlers are included.
History
Date User Action Args
2012-05-12 09:01:11chris.jerdoneksetrecipients: + chris.jerdonek
2012-05-12 09:01:11chris.jerdoneksetmessageid: <1336813271.29.0.464157696844.issue14787@psf.upfronthosting.co.za>
2012-05-12 09:01:10chris.jerdoneklinkissue14787 messages
2012-05-12 09:01:10chris.jerdonekcreate