import sys
from twisted.python.reflect import namedAny

def main():
    runner, connection_string, cookie = sys.argv[1:]
    print 'Starting %s on %s launching %s' % (cookie, connection_string, runner)
    sys.stdout.flush()

    try:
        runner = namedAny(runner)
    except ValueError:
        # namedAny brokenness
        sys.stderr.write('Could not import runner module\n')
        return 1
    
    return runner(cookie, connection_string)

if __name__ == '__main__':
    sys.exit(main())
