Can I find modules in a compressed package without first unpacking it?
I check the package using pkgutil.walk_packagesand pulling out all the modules using importlib.
for _, pkg, _ in pkgutil.walk_packages(package.__path__):
yield importlib.import_module(pkg)
This does not work when the bag is fastened. walk_packagestakes the way.
I can do this by first unpacking the package and using:
for _, pkg, _ in pkgutil.walk_packages(unzipped_package_path):
yield importlib.import_module(pkg)
But I would like to be able to do this without unpacking first.
pkgutil.getdataIt works with encrypted packets, I was surprised that it pkgutil.walk_packagesdoes not work.
I was wondering, something was missing.
Also, I'm limited to Python 2.7.0
source
share