[New-bugs-announce] [issue14022] bug in pkgutil.py with suggested fix

Don Caldwell report at bugs.python.org
Wed Feb 15 18:18:30 CET 2012

New submission from Don Caldwell <dfwcnj at gmail.com>:

in iter_modules there is a loop for fn in os.listdir(path): that can
fail on an OSError exception. here is a patch

                    for fn in os.listdir(path):
                        subname = inspect.getmodulename(fn)
                        if subname=='__init__':
                            ispkg = True
                        continue    # not a package
                except OSError as (errno, strerror):
                    print "%s: %s\n" % (fn, strerror)

components: Library (Lib)
messages: 153421
nosy: dfwc
priority: normal
severity: normal
status: open
title: bug in pkgutil.py with suggested fix
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list