当前位置: 首页>>代码示例>>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;未经允许,请勿转载。