[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

                try:
                    for fn in os.listdir(path):
                        subname = inspect.getmodulename(fn)
                        if subname=='__init__':
                            ispkg = True
                            break
                    else:
                        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>
<http://bugs.python.org/issue14022>
_______________________________________


More information about the New-bugs-announce mailing list