當前位置: 首頁>>代碼示例>>Python>>正文


Python Application.run方法代碼示例

本文整理匯總了Python中app.Application.run方法的典型用法代碼示例。如果您正苦於以下問題:Python Application.run方法的具體用法?Python Application.run怎麽用?Python Application.run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app.Application的用法示例。


在下文中一共展示了Application.run方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    app = Application(args=docopt(__doc__))
    config = app.load_config(DataTakerConfiguration)

    app.run(decoder=DataTakerDecoder,
            data_handlers=(DataTakerDataStorer(config.store_dir,
                                               config.backup_dir),),
            connection_handlers=((DataTakerConnectionHandler(config.cmd_file)),))
開發者ID:davidfialho14,項目名稱:pico_adapters,代碼行數:10,代碼來源:datataker.py

示例2: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    app = Application(args=docopt(__doc__))
    config = app.load_config(AethalometerConfiguration)

    app.run(decoder=AethalometerDecoder,
            data_handlers=(AethalometerDataStorer(config.store_dir,
                                                  config.backup_dir),),
            connection_handlers=())
開發者ID:davidfialho14,項目名稱:pico_adapters,代碼行數:10,代碼來源:aethalometer.py

示例3: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    setup = Setup()
    config = setup.run()

    app = Application(config)
    app.run()

    teardown = Teardown()
    teardown.run()
開發者ID:HarveyK86,項目名稱:PyREST,代碼行數:11,代碼來源:__main__.py

示例4: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    # initialize pygame
    pygame.init()
    pygame.display.set_mode((800, 600))

    # create game
    app = Application(Instruction)
    try:
        app.run()
    except KeyboardInterrupt:
        app.quit()
開發者ID:Grug16,項目名稱:Save-the-Robots-Game,代碼行數:13,代碼來源:game.py

示例5: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    # initialize pygame
    pygame.init()
    screen = pygame.display.set_mode((800, 800))
    pygame.display.set_caption("Super Coin Get")

    app = Application(screen)
    app.set_state(GameState)

    # create game
    try:
        app.run()
    except KeyboardInterrupt:
        app.quit()
開發者ID:HampshireCS,項目名稱:cs143-Spring2012,代碼行數:16,代碼來源:main.py

示例6: demo_main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def demo_main():
    script_basename = "youpinitel-demo"
    cfg_home = "/etc" if os.getuid() == 0 else ".youpinitel"

    parser = argparse.ArgumentParser(description="Youpi + Minitel demonstration")
    parser.add_argument(
        "-m",
        "--minitel-port",
        help="device to which the Minitel is connected (default: %(default)s)",
        dest="minitel_port",
        default="/dev/ttyUSB0",
    )
    parser.add_argument("-p", "--arm-port", help="device to which the arm interface is connected", dest="arm_port")
    parser.add_argument("-b", "--arm-busname", help="nROS bus name of the arm controller", dest="arm_busname")
    parser.add_argument(
        "-c",
        "--config-file",
        help="configuration file (default: %(default)s)",
        dest="config_file",
        type=file,
        default=os.path.join(cfg_home, "%s.json" % script_basename),
    )
    parser.add_argument("-d", "--debug", help="activates debug trace", action="store_true")

    args = parser.parse_args()

    try:
        app = Application(log=logging.getLogger("app"), **args.__dict__)

    except Exception as e:
        if args.debug:
            logging.exception("unexpected error")
        logging.getLogger().fatal("unable to initialize application instance (%s)", e)

    else:
        try:
            app.run()
        except Exception as e:
            if args.debug:
                logging.exception("unexpected error")
            else:
                # logging.getLogger().fatal('unexpected error : (%s) %s', e.__class__.__name__, e)
                logging.getLogger().exception(e)
        else:
            logging.getLogger().info("application terminated")
開發者ID:EricPobot,項目名稱:youpinitel-v1-raspi,代碼行數:47,代碼來源:entry_points.py

示例7: main

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def main():
    # initialize pygame
    pygame.init()
    screen = pygame.display.set_mode((600, 600))

    app = Application(Game)

    try:
        app.run()
    except KeyboardInterrupt:
        app.quit()
    screen = pygame.display.set_mode((800, 800))

    # create game
    game = Game(screen)
    try:
        game.run()
    except KeyboardInterrupt:
        game.quit()
開發者ID:jwsander,項目名稱:CS112-Spring2012,代碼行數:21,代碼來源:main.py

示例8: run

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
def run(args):
    try:
        app = Application(args.path)
        app.run()
    except IOError as e:
        print("error: failed to open file \"%s\"" % args.path)
開發者ID:lzh9102,項目名稱:jkbiv-gtk,代碼行數:8,代碼來源:__init__.py

示例9: Application

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import run [as 別名]
import sys
from app import Application
import logging
import scavenger

if __name__ == "__main__":
    # Set up logging.
    if '-d' in sys.argv:
        logging.basicConfig(level=logging.DEBUG,
                            format='%(asctime)s - %(levelname)s: %(message)s\n'\
                                   '\t%(filename)s, %(funcName)s, %(lineno)s',
                            datefmt='%m/%d/%y %H:%M:%S')
    else:
        logging.basicConfig(level=logging.ERROR,
                            format='%(asctime)s - %(levelname)s: %(message)s',
                            datefmt='%m/%d/%y %H:%M:%S')
    
    # Start the application.
    try:
        app = Application(sys.argv)
    except Exception, e:
        logging.getLogger('Main').error('Exception raised in main thread.', exc_info=True)
        sys.exit(1)
            
    rc = app.run()
    scavenger.shutdown()
    sys.exit(rc)
    
開發者ID:Danaze,項目名稱:scavenger-cf,代碼行數:29,代碼來源:main.py


注:本文中的app.Application.run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。