Logo Search packages:      
Sourcecode: distribute version File versions  Download package

def pkg_resources::get_importer (   path_item  ) 

Retrieve a PEP 302 "importer" for the given path item

If there is no importer, this returns a wrapper around the builtin import
machinery.  The returned importer is only cached if it was created by a
path hook.

Definition at line 1594 of file pkg_resources.py.

01594                            :
    """Retrieve a PEP 302 "importer" for the given path item

    If there is no importer, this returns a wrapper around the builtin import
    machinery.  The returned importer is only cached if it was created by a
    path hook.
    """
    try:
        importer = sys.path_importer_cache[path_item]
    except KeyError:
        for hook in sys.path_hooks:
            try:
                importer = hook(path_item)
            except ImportError:
                pass
            else:
                break
        else:
            importer = None

    sys.path_importer_cache.setdefault(path_item,importer)
    if importer is None:
        try:
            importer = ImpWrapper(path_item)
        except ImportError:
            pass
    return importer

try:
    from pkgutil import get_importer, ImpImporter
except ImportError:


Generated by  Doxygen 1.6.0   Back to index