[New-bugs-announce] [issue33210] pkgutil.walk_packages gives incomplete results

Cyker Way report at bugs.python.org
Mon Apr 2 22:25:38 EDT 2018


New submission from Cyker Way <cykerway at gmail.com>:

The current implementation of `pkgutil.walk_packages()` is confusing. Users may be given incomplete results while no exception is raised if they don't explicitly provide the `prefix` parameter. The doc says:

>   prefix is a string to output on the front of every module name on output.

But the fact is, `prefix` is not merely an output formatter at all. This function cannot handle an empty prefix (which is the default) and will often encounter import errors which are then simply ignored without an `onerror` function (which is default again).

See test program for details.

Doc:

https://docs.python.org/3.6/library/pkgutil.html#pkgutil.walk_packages

Source:

https://github.com/python/cpython/blob/3.6/Lib/pkgutil.py

----------
components: Library (Lib)
files: test.py
messages: 314850
nosy: cykerway
priority: normal
severity: normal
status: open
title: pkgutil.walk_packages gives incomplete results
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47516/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33210>
_______________________________________


More information about the New-bugs-announce mailing list