Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
locate ``name`` source file or directory.

Arguments:
   - name: A dotted-name in the same syntax used for importing.
Return:
   A string representing the path of the ``name`` object if this latest was
   found.
Raise:
   LocateError: When locating ``name`` fail.

        def locate(name):
    """locate ``name`` source file or directory.

    Arguments:
       - name: A dotted-name in the same syntax used for importing.
    Return:
       A string representing the path of the ``name`` object if this latest was
       found.
    Raise:
       LocateError: When locating ``name`` fail.

    """
    # First try locating an object w/o importing it.
    result = _locate_without_import(name)
    if result:
        return result

    try:
        obj = resolve(name)
    except ImportError:
        raise LocateError('object %r not found.' % name)

    try:
        output = os.path.abspath(getsourcefile(obj))
    except TypeError:
        raise LocateError('%r is built-in.' % obj)

    # Print also the line number of the object if it's not a module.
    if not ismodule(obj):
        line = getsourcelines(obj)[1]
        output += ' %d' % line
    return output
        


src/p/y/pywhereis-0.0.2/whereis/__init__.py   pywhereis(Download)
import getopt
 
from .util import locate, resolve, LocateError
 
 
            res = None
            try:
                res = locate(dotted_name)
            except LocateError:
                if verbose: