@inlineCallbacks
def main(reactor, tor_binary):
    config = txtorcon.TorConfig()
    config.ORPort = 0
    config.SOCKSPort = 0
    config.Tor2WebMode = 1
    # leaving ControlPort unset; launch_tor will choose one

    print "Launching tor...", tor_binary
    try:
        yield txtorcon.launch_tor(
            config,
            reactor,
            tor_binary=tor_binary,
            stdout=sys.stdout
        )
        print "success! We support Tor2Web mode"

    except __HOLE__ as e:
        print "There was a problem:", str(e)
        print "We do NOT support Tor2Web mode"
        return

    print "quitting in 5 seconds"
    reactor.callLater(5, lambda: reactor.stop())
    yield Deferred()  # wait forever because we never .callback()
dataset/ETHPy150Open meejah/txtorcon/examples/launch_tor2web.py/main