def run(args, stdout, stderr, petmail=None):
    """This is invoked directly by bin/petmail, which configures sys.path to
    contain everything necessary to run petmail from a source tree (e.g. the
    deps-venv's site-packages directory, and the source tree itself). It can
    also invoked by entry() below."""
    config = Options()
    try:
        config.parseOptions(args)
    except usage.error, e:
        c = config
        while hasattr(c, 'subOptions'):
            c = c.subOptions
        print >>stderr, str(c)
        print >>stderr, e.args[0]
        return 1
    command = config.subCommand
    so = config.subOptions
    so["petmail-executable"] = petmail
    try:
        rc = DISPATCH[command](so, stdout, stderr)
        return rc
    except __HOLE__, e:
        print >>stderr, "--- ImportError ---"
        print >>stderr, e
        print >>stderr, "Please run 'python setup.py build'"
        raise
        return 1
    except NoNodeError, e:
        print >>stderr, e
        return 1
dataset/ETHPy150Open warner/petmail/petmail/scripts/runner.py/run