def main():
    if len(sys.argv)<2:
        print "You must specify a command!"
        DumpCommands()
        return
    command = sys.argv[1]
    fn = globals().get(command)
    if fn is None:
        print "Unknown command:", command
        DumpCommands()
        return

    wincerapi.CeRapiInit()
    try:
        verinfo = wincerapi.CeGetVersionEx()
        print "Connected to device, CE version %d.%d %s" % (verinfo[0], verinfo[1], verinfo[4])
        try:
            fn(sys.argv[2:])
        except InvalidUsage, msg:
            print "Invalid syntax -", msg
            print fn.__doc__

    finally:
        try:
            wincerapi.CeRapiUninit()
        except win32api.error, details:
            print_error(details, "Error disconnecting")
dataset/ETHPy150Open deanhiller/databus/webapp/play1.3.x/python/Lib/site-packages/win32/scripts/ce/pysynch.py/main/original