New submission from Chris Jerdonek <chris.jerdo...@gmail.com>:

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.

----------
components: Library (Lib)
messages: 160464
nosy: cjerdonek
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages returns extra modules
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14787>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to