示例#1
0
def loadEnvironment(theEnvironment):
    theSVNVersion = get_svn_codec_version()
    theCodecVersion = get_codec_version()
    client = ClientEnvironment(theEnvironment)

    host = Network.kLocalHost
    port = Network.kDefaultPort

    hostString = os.getenv("RLGLUE_HOST")
    portString = os.getenv("RLGLUE_PORT")

    if (hostString != None):
        host = hostString

    try:
        port = int(portString)
    except TypeError:
        port = Network.kDefaultPort

    print "RL-Glue Python Environment Codec Version: " + theCodecVersion + " (Build " + theSVNVersion + ")"
    print "\tConnecting to " + host + " on port " + str(port) + "..."
    sys.stdout.flush()

    client.connect(host, port, Network.kRetryTimeout)
    print "\t Environment Codec Connected"

    client.runEnvironmentEventLoop()
    client.close()