Fix a bad assumption that all objects assigned to '__loader__' on a module

will have a '_files' attribute.
This commit is contained in:
Brett Cannon 2006-12-06 23:38:48 +00:00
parent 87fa559479
commit 8211297a7e
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,8 @@ def requires(resource, msg=None):
def find_package_modules(package, mask):
import fnmatch
if hasattr(package, "__loader__"):
if (hasattr(package, "__loader__") and
hasattr(package.__loader__, '_files')):
path = package.__name__.replace(".", os.path.sep)
mask = os.path.join(path, mask)
for fnm in package.__loader__._files.iterkeys():