pkgutil.ImpImporter

class pkgutil.ImpImporter(dirname=None) PEP 302 Importer that wraps Python’s “classic” import algorithm. If dirname is a string, a PEP 302 importer is created that searches that directory. If dirname is None, a PEP 302 importer is created that searches the current sys.path, plus any modules that are frozen or built-in. Note that ImpImporter does not currently support being used by placement on sys.meta_path. Deprecated since version 3.3: This emulation is no longer needed, as the standard i

pkgutil.get_loader()

pkgutil.get_loader(module_or_name) Get a PEP 302 “loader” object for module_or_name. If the module or package is accessible via the normal import mechanism, a wrapper around the relevant part of that machinery is returned. Returns None if the module cannot be found or imported. If the named module is not already imported, its containing package (if any) is imported, in order to establish the package __path__. Changed in version 3.3: Updated to be based directly on importlib rather than rely

pkgutil.get_importer()

pkgutil.get_importer(path_item) Retrieve a PEP 302 importer for the given path_item. The returned importer is cached in sys.path_importer_cache if it was newly created by a path hook. The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. Changed in version 3.3: Updated to be based directly on importlib rather than relying on the package internal PEP 302 import emulation.

pkgutil.get_data()

pkgutil.get_data(package, resource) Get a resource from a package. This is a wrapper for the PEP 302 loader get_data() API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using / as the path separator. The parent directory name .. is not allowed, and nor is a rooted name (starting with a /). The function returns a binary string that is the contents of the specified resource. For pa

pkgutil.find_loader()

pkgutil.find_loader(fullname) Retrieve a PEP 302 module loader for the given fullname. This is a backwards compatibility wrapper around importlib.util.find_spec() that converts most failures to ImportError and only returns the loader rather than the full ModuleSpec. Changed in version 3.3: Updated to be based directly on importlib rather than relying on the package internal PEP 302 import emulation. Changed in version 3.4: Updated to be based on PEP 451

pkgutil.extend_path()

pkgutil.extend_path(path, name) Extend the search path for the modules which comprise a package. Intended use is to place the following code in a package’s __init__.py: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories. It also looks for *.pkg files

pipes.Template.reset()

Template.reset() Restore a pipeline template to its initial state.

pipes.Template.prepend()

Template.prepend(cmd, kind) Add a new action at the beginning. See append() for explanations of the arguments.

pipes.Template.open()

Template.open(file, mode) Return a file-like object, open to file, but read from or written to by the pipeline. Note that only one of 'r', 'w' may be given.

pipes.Template.debug()

Template.debug(flag) If flag is true, turn debugging on. Otherwise, turn debugging off. When debugging is on, commands to be executed are printed, and the shell is given set -x command to be more verbose.